Skip to main content
 首页 » 编程设计

python之安装 PyLucene 时出现 ImportError : cannot import name Library,

2024年11月01日10qq78292959

我已经花了 5 个小时来解决这个问题,但我做不到。在使用 http://lucene.apache.org/pylucene/install.htmt 安装 PyLucene 期间,我遇到了如下错误。

sanghee-m:jcc sanghee$ python setup.py build 
found JAVAFRAMEWORKS = /System/Library/Frameworks/JavaVM.framework 
Traceback (most recent call last): 
  File "setup.py", line 398, in <module> 
    main('--debug' in sys.argv) 
  File "setup.py", line 306, in main 
    from setuptools import Library 
ImportError: cannot import name Library 
sanghee-m:jcc sanghee$ python setup.py build --debug 
found JAVAFRAMEWORKS = /System/Library/Frameworks/JavaVM.framework 
Traceback (most recent call last): 
  File "setup.py", line 398, in <module> 
    main('--debug' in sys.argv) 
  File "setup.py", line 306, in main 
    from setuptools import Library 
ImportError: cannot import name Library 
sanghee-m:jcc sanghee$  

我也找不到图书馆。我该如何解决这个问题?你能告诉我当我遇到这种错误时我应该检查哪里吗?

此外,我安装了 setuptools 1.1.6 并使用了 pylucene-4.4.0-1。

sanghee-m:jcc sanghee$ python 
Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45)  
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import setuptools 

请您参考如下方法:

我正在尝试在windows下编译JCC,发现最新版本的setuptools 1.1.6出现了你报的导入错误。但是,在 0.6c11 版本中,可以找到 Library 模块。

编辑:1.1.3 也适用。