2009-10-06 18 views
0

Salutations, J'essaie d'installer Pylucene sur mon python 32 bits fonctionnant sur Snow Leopard. J'ai compilé JCC avec succès. Mais je reçois des avertissements tout en pylucene:Pylucene en Python 2.6 + MacOs Snow Leopard

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 

J'essaie d'importer 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 
>>> 

Tous les conseils?

+0

Vous avez compilé jcc pour les différentes architectures - et ensuite vous compilez pylucene avec gcc4-01, et vous voulez construire seulement 32 bits. Je peux dire que sur snow leopard, avec python 2.6, mon python préféré est de mettre en 32bit, mais quand je compile jcc et lucene, le compilateur crée un binaire universel (i386 et 64bit) dans pylucene makefile, j'utilise: JCC = $ (PYTHON) -m jcc .__ main__ --shared --arch x86_64 --arch i386 cela fonctionne – roman

Répondre

0

Difficile à dire à coup sûr, mais pourrait être aussi simple que jcc n'étant pas installé dans le même emplacement python. Pour dépanner, j'essaierais d'utiliser jcc directement en premier. Ces commandes devraient fonctionner même sans Lucene:

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

Et le nom du module est Lucene, btw, pas pylucene.

+0

fonctionne JCC, Lucene ne: Python 2.6.3 (R263: 75184 , 2 octobre 2009, 07:56:03) [GCC 4.0.1 (Apple Inc. build 5493)] sur darwin Tapez "help", "copyright", "credits" ou "license" pour plus d'informations. >>> import jcc >>> jcc.initVM (jcc.CLASSPATH) >>> MacBookPro: ~/tmp/trunk – jbastos

+0

désolé au sujet de la mise en forme dans le commentaire ci-dessus. – jbastos

+0

J'ai oublié de lister getVMEnv() >>> jcc.jjc.getVMEnv() jbastos

1

j'ai dû ajuster la ligne 44 à 49 dans le Makefile pour obtenir pylucene installer correctement:

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 

Hope qui aide!