0

您好,我正在尝试在运行在 Snow Leopard 上的 32 位 python 上安装 Pylucene。我成功编译了 JCC。但是我在制作 pylucene 时收到警告:

ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/__init__.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/__wrap01__.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/__wrap02__.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/__wrap03__.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/functions.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/JArray.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/JObject.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/lucene.o, file is not of required architecture
ld: warning: in build/temp.macosx-10.6-i386-2.6/build/_lucene/types.o, file is not of required architecture
ld: warning: in /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/JCC-2.3-py2.6-macosx-10.3-fat.egg/libjcc.dylib, file is not of required architecture
ld: warning: in /Developer/SDKs/MacOSX10.4u.sdk/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/JCC-2.3-py2.6-macosx-10.3-fat.egg/libjcc.dylib, file is not of required architecture
build of complete

然后我尝试导入lucene:

MacBookPro:~/tmp/trunk python
Python 2.6.3 (r263:75184, Oct  2 2009, 07:56:03) 
[GCC 4.0.1 (Apple Inc. build 5493)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylucene
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pylucene
>>> import lucene
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lucene-2.9.0-py2.6-macosx-10.6-i386.egg/lucene/__init__.py", line 7, in <module>
    import _lucene
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lucene-2.9.0-py2.6-macosx-10.6-i386.egg/lucene/_lucene.so, 2): Symbol not found: __Z8getVMEnvP7_object
  Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lucene-2.9.0-py2.6-macosx-10.6-i386.egg/lucene/_lucene.so
  Expected in: flat namespace
 in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/lucene-2.9.0-py2.6-macosx-10.6-i386.egg/lucene/_lucene.so
>>> 

有什么提示吗?

4

2 回答 2

1

我必须将 Makefile 中的第 44 行调整为第 49 行,才能正确安装 pylucene:

PREFIX_PYTHON=/my/virtualenv
ANT=ant
PYTHON=$(PREFIX_PYTHON)/bin/python
# add .__main__ to default configuration!
# --arch depends on your architecture of course
JCC=$(PYTHON) -m jcc.__main__ --shared --arch x86_64                                                                                                                                                                      
NUM_FILES=2

希望有帮助!

于 2011-01-31T23:22:16.900 回答
0

很难确定,但可能就像 jcc 没有安装在同一个 python 位置一样简单。要进行故障排除,我会先尝试直接使用 jcc。即使没有 lucene,这些命令也应该可以工作:

>>> import jcc
>>> jcc.initVM(jcc.CLASSPATH)
<jcc.JCCEnv object at 0x1004730d8>
>>> jcc._jcc.getVMEnv()
<jcc.JCCEnv object at 0x1004730f0>

并且模块名称是lucene,顺便说一句,不是pylucene。

于 2009-10-06T19:52:34.667 回答