PyLucene
pyLucene 是搜索引擎 Lucene 的 python 版本,官网 https://lucene.apache.org/pylucene
Install
One by one install
安装 g++
sudo apt autoremove
sudo apt-get install build-essential
安装 jdk
Linux之Ubuntu18.04安装Java JDK8的三种方式_软测小生-CSDN博客_ubuntu安装jdk8
# Openjdk 安装 JDK
sudo apt-get update
sudo apt-get install openjdk-8-jdk
java -version
查看 JDK 位置
whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz
ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 9月 13 00:23 /usr/bin/java -> /etc/alternatives/java
ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 46 9月 13 00:23 /etc/alternatives/java -> /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
最后可以得知路径在 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
安装ANT
wget http://mirror.sobukus.de/files/apache/ant/apache-ant-1.9.14-bin.tar.gz
tar zxvf apache-ant-1.9.14-bin.tar.gz
export ANT_HOME=./apache-ant-1.9.14
export PATH=$PATH:$ANT_HOME/bin
export ANT_OPTS="-Xms1300m -Xmx2048m -XX:PermSize=128M -XX:MaxNewSize=256m -XX:MaxPermSize=256m"
安装 pylucene
version="8.8.1"
wget "https://archive.apache.org/dist/lucene/pylucene/pylucene-${version}-src.tar.gz"
tar zxvf "pylucene-${version}-src.tar.gz"
安装 JCC
cd "pylucene-${version}/jcc"
setup.py中修改jdk位置
python setup.py build
python setup.py install
JDK = {
'darwin': JAVAHOME or JAVAFRAMEWORKS,
'ipod': '/usr/include/gcc',
'linux': '/usr/lib/jvm/java-8-openjdk-amd64',
'sunos5': '/usr/jdk/instances/jdk1.6.0',
'win32': JAVAHOME,
'mingw32': JAVAHOME,
'freebsd7': '/usr/local/diablo-jdk1.6.0'
}
安装lucene
cd "pylucene-${version}"
vi Makefile
# 要在 Makefile 中增加下面的东西
PREFIX_PYTHON=${HOME}/anaconda3
ANT=/home/v-fhu/install_bag/apache-ant-1.9.14/bin/ant
PYTHON=$(PREFIX_PYTHON)/bin/python
JCC=$(PYTHON) -m jcc.main
NUM_FILES=8
make
make install
终于搞定了
Installed /home/v-fhu/anaconda3/lib/python3.9/site-packages/lucene-8.8.1-py3.9-linux-x86_64.egg
Processing dependencies for lucene==8.8.1
Finished processing dependencies for lucene==8.8.1
Python 3.9.7 (default, Sep 16 2021, 13:09:58)
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lucene
>>>
docker install
docker pull coady/pylucene
|