Install PyLucene on Mac

I would like to be able to use pyLucene on my Mac. The instructions have hopelessly lost me, because each setup or creation instruction requires me to do something before this, and it is difficult to understand where to start and what to make from which window.

I downloaded PyLucene. The first thing that interests me is where I put the folder, as this does not seem to me for granted.

To use it, I was told that I need to create a JCC that is included in the pylucene download.

Instructions:

At the command prompt, type:

$ python setup.py build $ sudo python setup.py install 

But for this, I think I need to be in the right place or put the folder in the right place, because otherwise I get "setup.py" not found .

Any help you can offer in this environment (shell window? IDE?). Any help in getting this first part: creating a JCC and then creating a pill is very much appreciated.

+4
source share
2 answers

Download the pre-created JCC and pylucene eggs for Mac from here .

Currently the latest versions are: JCC-2.8 and lucene-3.1.0 for python 2.6, so below I will use easy_install-2.6 and python2.6.

Install them:

 $ sudo easy_install-2.6 JCC-*.egg $ sudo easy_install-2.6 lucene-*.egg 

Test:

 $ python2.6 >>> import jcc >>> import lucene Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Python/2.6/site-packages/lucene-3.1.0-py2.6-macosx-10.6-universal.egg/lucene/__init__.py", line 7, in <module> import _lucene ImportError: dlopen(/Library/Python/2.6/site-packages/lucene-3.1.0-py2.6-macosx-10.6-universal.egg/lucene/_lucene.so, 2): Library not loaded: @rpath/libjcc.dylib Referenced from: /Library/Python/2.6/site-packages/lucene-3.1.0-py2.6-macosx-10.6-universal.egg/lucene/_lucene.so Reason: image not found 

If you get the above error, fix it just by creating a libjcc.dylib symbolic link in /usr/local/lib/ . libjcc.dylib should be inside site-packages/JCC-*.egg/ .

 >>> jcc.__file__ '/Library/Python/2.6/site-packages/JCC-2.8-py2.6-macosx-10.7-intel.egg/jcc/__init__.pyc' >>> ^D $ ln -s /Library/Python/2.6/site-packages/JCC-2.8-py2.6-macosx-10.7-intel.egg/libjcc.dylib /usr/local/lib/ $ python2.6 >>> import jcc, lucene >>> 
+3
source

This works with recent macOS versions. First, make sure you install:

Then add to your ~/.bash_profile :

 export JAVA_HOME=$(/usr/libexec/java_home) 

Then reload your shell.

Download PyLucene and extract the cd folder from it. Now follow the instructions of the official installation guide :

 cd jcc python setup.py build 

Now install JCC:

 python setup.py install 

(A sudo may be required if you are using a macOS Python system.)

Now go back to the parent folder and edit the Makefile . Replace uncomplexed strings as indicated in the actual path to ant , python , jcc and NUM_FILES :

 ANT=ant PYTHON=python JCC=python -m jcc NUM_FILES=8 

Now create PyLucene:

 make make test 

Finally, to install the built-in PyLucene:

 make install 

(You may need sudo when using the Python system.)

+3
source

All Articles