$ sudo apt-get install pylucene
However the version is a bit outdated, so I try installing it from source. For people who don't want to install it in their local virtualenv the whole process is well discribed here: http://john.wesorick.com/2011/11/installing-pylucene-on-ubuntu
I'll stick to the structure of this description but tweak it to be installed in my virtualenv.
Get Java
$ sudo apt-get install openjdk-7-jre openjdk-7-jdk ant
Get and unpack PyLucene's source
$ wget http://www.eu.apache.org/dist/lucene/pylucene/pylucene-(latest) $ tar xvfx pylucene-(latest)In my case (latest) is version 3.6.0-2
Build jcc
$ cd pylucene-3.6.0-2/jcc/Edit setup.py and change the dictionary JDK to contain the Java version just installed:
JDK = { 'linux2': '/usr/lib/jvm/java-7-openjdk-i386', }Now run the setup, I didn't have patches setuptools, I guess that's due to the different version you get in your virtualenv? Anyway:
$ python setup.py install
Build PyLucene
Edit Makefile in the root directory: I have to set the following variables:# pylucene-3.6.0-2/Makefile # ... PREFIX_PYTHON=(path/to/your/virtualenv) ANT=JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386 /usr/bin/ant PYTHON=$(PREFIX_PYTHON)/bin/python JCC=$(PYTHON) -m jcc --shared NUM_FILES=4If you don't know the path to your virtualenv, type 'which python', $PREFIX_PYTHON is the the bit in front of '/bin'.
Now build PyLucene and see whether it works.
$ make $ make install $ make test
No comments:
Post a Comment