在 Ubuntu 10.04 上安装 PyLucene 3.0.3

发布于 2024-10-30 19:04:42 字数 2476 浏览 0 评论 0原文

我正在尝试在 Ubuntu 10.04 上安装 PyLucene 3.0.3。事实证明,这相当具有挑战性,但到目前为止,我已经:

  • 修补了 setuptools 以允许构建 JCC,如 PyLucene 文档中的说明。
  • 通过以下方式构建 JCC:cd pylucene-3.0.3-1/jcc; python setup.py build
  • 通过ant构建Lucene 3.0.3,并将jar安装到/usr/share/java/lucene-core-3.0.3-dev.jar。注意,我已将 Ubuntu 的默认 Lucene 包安装到 /usr/share/java/lucene-core-2.9.2.jar,它也符号链接到 /usr/share/java/lucene-core.jar

我现在正在尝试“make “ PyLucene,但我收到错误:

cd lucene-java-3.0.3;  -Dversion=3.0.3
/bin/sh: -Dversion=3.0.3: not found
make: *** [lucene-java-3.0.3/build/lucene-core-3.0.3.jar] Error 127

文件 pylucene-3.0.3-1/doc/documentation/install.html 提到“编辑 Makefile 以匹配您的环境”,但我不确定这意味着什么。 makefile 似乎包含与我安装的版本号相同的 Lucene 版本号。我还需要如何编辑 makefile 才能构建 PyLucene?

编辑:在取消注释 makefile 中用于在 Ubuntu 8.10(说真的,8.10?!)下编译的部分后(感谢 Torsten),大部分内容似乎编译得很好,但我仍然收到错误。多个组件报告“构建成功”,但最终构建结束时:

/usr/bin/python -m jcc --shared --jar lucene-java-3.0.3/build/lucene-core-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/snowball/lucene-snowball-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/analyzers/common/lucene-analyzers-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/regex/lucene-regex-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/memory/lucene-memory-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/highlighter/lucene-highlighter-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/queries/lucene-queries-3.0.3.jar --jar build/jar/extensions.jar  --package java.lang java.lang.System java.lang.Runtime --package java.util java.util.Arrays java.text.SimpleDateFormat java.text.DecimalFormat java.text.Collator --package java.io java.io.StringReader java.io.InputStreamReader java.io.FileInputStream --exclude org.apache.lucene.queryParser.Token --exclude org.apache.lucene.queryParser.TokenMgrError --exclude org.apache.lucene.queryParser.QueryParserTokenManager --exclude org.apache.lucene.queryParser.ParseException --exclude org.apache.lucene.search.regex.JakartaRegexpCapabilities --exclude org.apache.regexp.RegexpTunnel --python lucene --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer --version 3.0.3 --module python/collections.py --files 200 --build 
/usr/bin/python: jcc is a package and cannot be directly executed
make: *** [compile] Error 1

I'm attempting to install PyLucene 3.0.3 on Ubuntu 10.04. This has proven considerably challenging, but so far I've:

  • Patched setuptools to allow building of JCC, as instructed in the PyLucene docs.
  • Built JCC via: cd pylucene-3.0.3-1/jcc; python setup.py build
  • Built Lucene 3.0.3 via ant, and installed the jar to /usr/share/java/lucene-core-3.0.3-dev.jar. Note, I have Ubuntu's default Lucene package installed to /usr/share/java/lucene-core-2.9.2.jar which also symlinks to /usr/share/java/lucene-core.jar

I'm now trying to "make" PyLucene, but I get the error:

cd lucene-java-3.0.3;  -Dversion=3.0.3
/bin/sh: -Dversion=3.0.3: not found
make: *** [lucene-java-3.0.3/build/lucene-core-3.0.3.jar] Error 127

The file pylucene-3.0.3-1/doc/documentation/install.html makes mention to "edit Makefile to match your environment", but I'm not sure what that means. The makefile seems to contain the same Lucene version number as the one I installed. How else do I need to edit my makefile in order to build PyLucene?

Edit: After uncommenting a section in the makefile (thanks Torsten) for compiling under Ubuntu 8.10 (seriously, 8.10?!) most of it seemed to compile fine, but I still received an error. Several components reported "BUILD SUCCESSFUL" but the final build ended with:

/usr/bin/python -m jcc --shared --jar lucene-java-3.0.3/build/lucene-core-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/snowball/lucene-snowball-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/analyzers/common/lucene-analyzers-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/regex/lucene-regex-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/memory/lucene-memory-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/highlighter/lucene-highlighter-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/queries/lucene-queries-3.0.3.jar --jar build/jar/extensions.jar  --package java.lang java.lang.System java.lang.Runtime --package java.util java.util.Arrays java.text.SimpleDateFormat java.text.DecimalFormat java.text.Collator --package java.io java.io.StringReader java.io.InputStreamReader java.io.FileInputStream --exclude org.apache.lucene.queryParser.Token --exclude org.apache.lucene.queryParser.TokenMgrError --exclude org.apache.lucene.queryParser.QueryParserTokenManager --exclude org.apache.lucene.queryParser.ParseException --exclude org.apache.lucene.search.regex.JakartaRegexpCapabilities --exclude org.apache.regexp.RegexpTunnel --python lucene --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer --version 3.0.3 --module python/collections.py --files 200 --build 
/usr/bin/python: jcc is a package and cannot be directly executed
make: *** [compile] Error 1

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不即不离 2024-11-06 19:04:42

我之前这样做过(但没有在 Ubuntu 中安装 Lucene 的默认包)。我不知道 Error 127 到底是什么,但就我而言,它有助于从原始 NUM_FILES=2 设置 NUM_FILES=200我的Makefile。由于某种原因,当 NUM_FILES=2 时,它会在内存中创建非常大的文件,而 ubuntu 无法处理这些文件。使用 NUM_FILES=200 块更小,安装最终对我有用。对于 python 2.6,您还必须更改 Makefile 中的 JCC 设置(见下文)。

这是 Makefile 中对我来说很重要的部分:

# Linux     (Ubuntu 8.10 64-bit, Python 2.5.2, OpenJDK 1.6, setuptools 0.6c9)
PREFIX_PYTHON=/usr
ANT=ant
PYTHON=$(PREFIX_PYTHON)/bin/python
JCC=$(PYTHON) -m jcc.__main__ --shared
NUM_FILES=200

I did this before (but without installing Lucene's default package in Ubuntu). I don't know what exactly is Error 127, but in my case it helped to set NUM_FILES=200 from the original NUM_FILES=2 in my Makefile. For some reason when NUM_FILES=2 it creates really huge files in memory which ubuntu will not handle. With NUM_FILES=200 the chunks are smaller and installation worked for me in the end. For python 2.6 you also have to change the JCC setting in Makefile (see below).

Here the part which was important for me in the Makefile:

# Linux     (Ubuntu 8.10 64-bit, Python 2.5.2, OpenJDK 1.6, setuptools 0.6c9)
PREFIX_PYTHON=/usr
ANT=ant
PYTHON=$(PREFIX_PYTHON)/bin/python
JCC=$(PYTHON) -m jcc.__main__ --shared
NUM_FILES=200
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文