我最近安装了django和psycop2。但是python拒绝在下面使用它是错误。有人可以帮忙吗?
>>> import psycopg2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/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(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
Referenced from: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so
Expected in: flat namespace
in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/psycopg2/_psycopg.so
答案 0 :(得分:1)
macports对于python / django开发来说很糟糕,一切似乎都没有数据。
我让我的团队为postgres做了以下事情:
然后用
安装python setup.py install
我建议您使用virtualenv,您希望尽可能远离基本的Mac OS X python安装。