我在UbuntuOS11.4上使用Eclipse中的Pydev(2.5.0)插件开发了一个Python程序。
该程序使用lucene (核心3.6)库。Lucene是使用jcc安装的。在此之前,我使用文本编辑器开发了它,并使用python xxx.py
在命令行上运行,对于lucene库没有问题。
然后,我将项目导入Eclipse。其他源文件仍然按原样运行,但程序无法找到lucene库的基本类。
import lucene # no error
但是,如果我试图导入StandardAnalyzer
或任何其他类,则会得到一个错误:
from lucene import StandardAnalyzer #error: unresolved import
我的配置:
usr/bin/python2.7语法版本: 2.7
图书馆包括:
我尝试将lucene文件夹添加到外部库中,但是没有帮助。我通过使用命令行python解释器和这些命令找到了这个路径。
import lucene
print lucene.__path__
虽然库中已经有类似的路径(请参阅图像)。第二图书馆)
'/usr/local/lib/python2.7/dist-packages/lucene-3.6.0-py2.7-linux-i686.egg/lucene‘
我很感谢你对这个问题的评论。谢谢。
发布于 2012-06-12 03:50:50
我认为问题在于PyDev代码分析器不能真正分析PyLucene。您可以尝试将'lucene‘添加到window > preferences > pydev >解释器- python >强制构建(有关详细信息,请参见:http://pydev.org/manual_101_interpreter.html )。
发布于 2013-09-27 11:45:43
在MacOSX10.8.5上运行HeliosServiceRelease2也有同样的问题。将其固定如下:
- Select PyDev - Interpreter/Grammar
- Click "Click here to configure an interpreter not listed"
- Select your interpreter
选择“强制构建”并添加所有三个目录(lucene、org和java) ( details).
中。
https://stackoverflow.com/questions/10871063
复制相似问题