[Lucene]Install pylucene 4.4.0 on Ubuntu 13.04

Install pylucene 4.4.0 on ubuntu 13.04

Requirements

  1. python(of course)
  2. python-dev
  3. setuptools
  4. jdk
  5. jcc
  6. Ant

Install python 2.7.5

blah blah
	

Intall python-dev

sudo apt-get install python-dev
	

Install setuptools(easy_install)

get the source code,and just :python ez_setup.py

Install jdk

It's annoying to config sun-jdk, we just use open-jdk instead.

Check your jdk version

java -version
	javac -version
	

you may get this:

$java -version
	java version "1.7.0_21"
	OpenJDK Runtime Environment (IcedTea 2.3.9) (7u21-2.3.9-1ubuntu1)OpenJDK Server VM (build 23.7-b01, mixed mode)
	
	$javac -version
	javac 1.7.0_21
	

the javac version should be the same with java version.
if you are not sure that your jdk is installed correctly, you can just restore it by apt-get or yum.

Install jcc

cd jcc
	

and modify the JDK path:

JDK = {
	'darwin': JAVAHOME,
	'ipod': '/usr/include/gcc',
	'linux2': '/usr/lib/jvm/java-7-openjdk-amd64', <---change this path
	'sunos5': '/usr/jdk/instances/jdk1.6.0',
	'win32': JAVAHOME,
	'mingw32': JAVAHOME,
	'freebsd7': '/usr/local/diablo-jdk1.6.0'
	}
	

than build and restore:

python setup.py build
	sudo python setup.py install
	

if there's no errors, congratulations! You are close to success.

Get Ant

just:

sudo apt-get install ant
	

Install pylucene

modify the Makefile:

# Linux (Ubuntu 11.10 64-bit, Python 2.7.2, OpenJDK 1.7, setuptools 0.6.16)
	# Be sure to also set JDK['linux2'] in jcc's setup.py to the JAVA_HOME value
	# used below for ANT (and rebuild jcc after changing it).
	PREFIX_PYTHON=/usr
	ANT=JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-i386 /usr/bin/ant
	PYTHON=$(PREFIX_PYTHON)/bin/python
	JCC=$(PYTHON) -m jcc --shared
	NUM_FILES=2
	

now type the exciting command:

make
	sudo make install
	

if no errors occur, you've made it!

Test pylucene

get into python and type:

>>import lucene
	>>
	

Ok, that's all if you see the second prompt!

猜你喜欢

转载自blog.csdn.net/DSbatigol/article/details/14135035
今日推荐