OSX Lion 上的 psycopg2 安装问题
我使用 PIP 在 OSX Lion 上安装 psycopg2。但是当我尝试从 python 导入时,出现以下错误:
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] 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 "/Library/Python/2.7/site-packages/psycopg2/__init__.py", line 67, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
Referenced from: /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
>>>
有谁知道如何解决这个问题?
谢谢!
莫斯科
I used PIP to install psycopg2 on OSX Lion. But when I try to import from python I get the following errors:
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] 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 "/Library/Python/2.7/site-packages/psycopg2/__init__.py", line 67, in <module>
from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: dlopen(/Library/Python/2.7/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID
Referenced from: /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
Expected in: flat namespace
in /Library/Python/2.7/site-packages/psycopg2/_psycopg.so
>>>
Does anyone know how to fix this?
Thanks!
Mosko
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
步骤 1.
使用 Lion dmg 安装 Mac Ports ( www.macports.org )。
步骤 2.
sudo port install postgresql91
步骤 3.
export PATH=/opt/local/lib/postgresql91/bin:$PATH
步骤 4.
pip install psycopg2
(如果在 virtualenv 环境中)或
sudo port install psycopg2(
如果不是)。
Step 1.
Install Mac Ports ( www.macports.org ) using the Lion dmg.
Step 2.
sudo port install postgresql91
Step 3.
export PATH=/opt/local/lib/postgresql91/bin:$PATH
Step 4.
pip install psycopg2
if in a virtualenv environment or
sudo port install psycopg2
if not.