1

更新到 Mac OS X Mountain Lion 后出现 psycopg2 错误,之前它工作正常。如果我尝试导入模块,这是错误:

    Python 2.7.3 (default, Sep 27 2012, 21:57:16) 
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.65))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import psycopg2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/__init__.py", line 67, in <module>
    from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _GSS_C_NT_HOSTBASED_SERVICE
  Referenced from: /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so
  Expected in: flat namespace
 in /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so

我使用 brew 来安装 python 和 psycopg2。任何想法都会有所帮助。

谢谢亚历克斯

4

2 回答 2

1

也尝试酿造 postgresql。错误可能在于 libpq(PostgreSQL 客户端库,其中 psycopg 是一个包装器)的链接方式。

于 2012-10-07T01:38:48.040 回答
0

混合原生和 brew 应用程序并不是那么好......我宁愿从 brew 卸载 psycopg2 和 python 并安装“命令行工具”,就像pip install failed with /usr/bin/clang: No such file or directory中解释的那样。然后重试 pip install ,它会工作,至少它为我完成了工作!

于 2012-11-13T14:58:35.827 回答