【问题标题】:Installing PyLucene 3.0.3 on Ubuntu 10.04在 Ubuntu 10.04 上安装 PyLucene 3.0.3
【发布时间】:2011-07-30 11:01:53
【问题描述】:

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

  • 修补了 setuptools 以允许按照 PyLucene 文档中的说明构建 JCC。
  • 通过以下方式构建 JCC:cd pylucene-3.0.3-1/jcc; python setup.py 构建
  • 通过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

我现在正在尝试“制作”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 版本号。为了构建 PyLucene,我还需要如何编辑我的 makefile?

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

/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

【问题讨论】:

    标签: java python lucene makefile pylucene


    【解决方案1】:

    我以前这样做过(但没有在 Ubuntu 中安装 Lucene 的默认包)。我不知道Error 127 到底是什么,但在我的情况下,它有助于在我的Makefile 中从原始NUM_FILES=2 设置NUM_FILES=200。出于某种原因,当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
    

    【讨论】:

    • 抱歉,没有看到您添加了__main__。那编译得很完美。谢谢。
    • 没问题。很高兴我能帮助你。安装 PyLucene 应该非常容易。我总是为此花半天时间。 ://
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 2015-09-05
    • 2011-08-30
    • 2011-05-08
    • 2011-10-31
    • 2013-02-23
    相关资源
    最近更新 更多