【发布时间】:2014-04-14 15:45:45
【问题描述】:
我在我的 Eclipse 中安装了 Pydev 插件,我在我的 python 代码中调用 PyLucene。 Lucene 在 PYTHONPATH 中,因此
import lucene
没有错误。但是尝试使用从 lucene 类派生的任何东西都会出现“未解决的导入”错误。例如,
from org.apache.lucene.analysis.standard import StandardAnalyzer
from org.apache.lucene.index import DirectoryReader
from org.apache.lucene.queryparser.classic import QueryParser
from org.apache.lucene.search import IndexSearcher
from org.apache.lucene.store import SimpleFSDirectory
from org.apache.lucene.util import Version
上面的所有行都给出了这个错误。此外,这段代码在我的 bash-shell 的命令行中运行良好。因此,我确保我的 Eclipse 使用与我在 shell 中使用的相同的 PATH、LD_LIBRARY_PATH 和 PYTHONPATH 值。但是,错误仍然存在。
这里可能出了什么问题?
【问题讨论】:
-
我有同样的问题,但它与 PyCharm - 它看不到 org.apache... 路径。在 REPL 中,所有导入都有效,但无法使用代码检查和其他 IDE 功能。你遇到同样的问题吗?有什么解决办法吗?
标签: python-2.7 lucene pydev pylucene