Pylons 导入 Psycopg2 错误

发布于 2024-08-09 02:28:13 字数 687 浏览 5 评论 0原文

    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 来代替。

    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 was working fine before, but now I get this error.

Any ideas on this issue much appreciated.


EDIT: so after dealing with so many psycopg2 errors everytime I set up my mac, I've decided to use VMWareFusion running Ubuntu instead.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

治碍 2024-08-16 02:28:13

难道是 postgres 安装被删除/更新了吗?该符号应该来自 libpq。

Could it be that the postgres installation was removed/updated? The symbol is supposed to come from libpq.

失退 2024-08-16 02:28:13

这对我来说也很糟糕,就我而言,这似乎不是 32 位与 64 位的问题:

[email protected][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
[email protected][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
[email protected][6:56]~/src:87%

This is broken for me too, and in my case it doesn't appear to be a 32 vs 64 bit issue:

[email protected][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
[email protected][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
[email protected][6:56]~/src:87%
我不是你的备胎 2024-08-16 02:28:13

您收到此错误是因为您的 64 位版本的 python 找不到 64 位 psycopg2。

您可以将 python 降级为在 32 位模式下运行,或者尝试获取 64 位 psycopg2。关于此主题有更多讨论 本·克里格的博客

You get this error because your 64-bit version of python can't find a 64-bit psycopg2.

You can either downgrade your python to run in 32-bit mode or try to get a 64-bit psycopg2. There is more discussion on this topic over on Ben Kreeger's blog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文