Pylons导入Psycopg2错误

时间:2009-10-26 07:06:41

标签: python pylons psycopg2

    Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/Library/Python/2.6/site-packages/psycopg2/__init__.py", line 60, in <module>
   from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Python/2.6/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
 Referenced from: /Library/Python/2.6/site-packages/psycopg2/_psycopg.so
 Expected in: flat namespace
 in /Library/Python/2.6/site-packages/psycopg2/_psycopg.so

之前Psycopg2工作正常,但现在我收到了这个错误。

对这个问题的任何想法都非常感激。


编辑:所以每次设置我的mac后处理这么多psycopg2错误后,我决定使用运行Ubuntu的VMWareFusion。

4 个答案:

答案 0 :(得分:4)

您收到此错误,因为您的64位版本的python无法找到64位psycopg2。

您可以降级python以在32位模式下运行或尝试获取64位psycopg2。在Ben Kreeger's blog上有关于此主题的更多讨论。

答案 1 :(得分:1)

是不是删除/更新了postgres安装?该符号应该来自libpq。

答案 2 :(得分:1)

对我来说也是如此,在我的情况下,它似乎不是32比64位问题:

decibel@workbook.1[6:55]~/src:85%file /opt/local/lib/postgresql83/libpq.dylib 
/opt/local/lib/postgresql83/libpq.dylib: Mach-O 64-bit dynamically linked shared library x86_64
decibel@workbook.1[6:56]~/src:86%file ~/.python-eggs/psycopg2-2.0.14-py2.6-macosx-10.6-universal.egg-tmp/psycopg2/_psycopg.so 
/Users/decibel/.python-eggs/psycopg2-2.0.14-py2.6-macosx-10.6-universal.egg-tmp/psycopg2/_psycopg.so: Mach-O universal binary with 3 architectures
/Users/decibel/.python-eggs/psycopg2-2.0.14-py2.6-macosx-10.6-universal.egg-tmp/psycopg2/_psycopg.so (for architecture i386):   Mach-O bundle i386
/Users/decibel/.python-eggs/psycopg2-2.0.14-py2.6-macosx-10.6-universal.egg-tmp/psycopg2/_psycopg.so (for architecture ppc7400):    Mach-O bundle ppc
/Users/decibel/.python-eggs/psycopg2-2.0.14-py2.6-macosx-10.6-universal.egg-tmp/psycopg2/_psycopg.so (for architecture x86_64): Mach-O 64-bit bundle x86_64
decibel@workbook.1[6:56]~/src:87%

答案 3 :(得分:1)

通过forcing Apache executables 32 bit execution

解决了类似问题