Installing PyLucene 6

I plan to implement a basic, tiny and reliable web search engine these days. It was difficult to write a search system all by myself, so I try to use PyLucene. After installing PyLucene on my Ubuntu, I find it a little bit user-unfriendly during the installation. However, this article will show how to install PyLucene.

About PyLucene

PyLucene is a Python extension for accessing Java Lucene. Its goal is to allow you to use Lucene’s text indexing and searching capabilities from Python. You can also visit here to get more info about PyLucene.

Requirement

  • Python 2.x (x >= 3.5)
  • Java 1.x (x >= 7)

Installation

  1. Download PyLucene Source from PyLucene
  2. Unzip PyLucene

    1
    $ tar -zxvf pylucene-6.2.0-src.tar.gz
  3. Install Ant, g++, python-dev

    1
    $ sudo apt-get install ant g++ python-dev
  4. Build and install PyLucene/JCC

    1
    2
    3
    4
    cd to pylucene/jcc
    modify setup.py (the only thing you need to do is change the name of JDK file)
    $ sudo python setup.py build
    $ sudo python setup.py install
  5. Make and install PyLucene

    1
    2
    3
    4
    5
    cd to pylucene
    modify Makefile (just uncomment lines for Ubuntu or your OS, don't forget to change the name of JDK file)
    $ make
    and it may take 10 minutes
    $ sudo make install
  6. Cong! Installation success! Try import lucene!