psycopg安装问题

发布于 2024-12-02 12:28:35 字数 806 浏览 1 评论 0原文

我最近安装了 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

I've recently installed django and psycop2. However python is refusing to use it below is the error. Can someone please help?

>>> 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

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

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

发布评论

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

评论(1

半步萧音过轻尘 2024-12-09 12:28:35

macports 对于 python/django 开发来说很糟糕,一切似乎都没有数据。

我让我的团队为 postgres 执行以下操作:

  1. 下载并安装 postgresql 9.0 但之前请阅读自述文件
    安装!!!
  2. http://initd.org/pub/software/psycopg/ 下载 psycopg2 源代码
  3. 编辑setup.cfg 将 pg_config 设置为
    /Library/PostgreSQL/9.0/bin/pg_config

然后安装

python setup.py install

我也建议使用 virtualenv,你想尽可能远离基本的 Mac OS X python 安装。

macports is terrible for python/django development, everything seems to be out of data.

I have my team doing the following for postgres:

  1. Download and install postgresql 9.0 but read the README before
    installing !!!
  2. Download psycopg2 source from http://initd.org/pub/software/psycopg/
  3. Edit the setup.cfg to set pg_config to
    /Library/PostgreSQL/9.0/bin/pg_config

Then install with

python setup.py install

I'd recommend using virtualenv as well, you want to stay away from the base Mac OS X python install as much as possible.

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