osx 下的 Psycopg2 在命令行上可以工作,但在 Aptana studio 中失败

发布于 2024-09-16 05:00:24 字数 861 浏览 11 评论 0原文

这 6 个月来我一直在 Python/Snowleopard 下愉快地进行开发。我刚刚将 Python 升级到 2.6.5 和一大堆库,包括 psycopg2 和 Turbogears。我可以启动 tg-admin 并毫无问题地运行一些查询。同样,我可以毫无问题地从命令行运行我的网站。

但是,如果我尝试在 Aptana Studio 下启动应用程序,则在尝试导入 Psychopg2 时会出现以下异常:

('dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages /psycopg2/_psycopg.so,2):找不到符号:_PQbackendPID\n 引用自:/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so\n预期位于: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so' 中的平面命名空间\n

运行以下代码后会发生这种情况: 尝试: 将 psycopg2 导入为 psycopg 除了导入错误,例如: print "导入失败:-( xxxxxxxx = " print ex.args

我已经确认相同版本的 python 正在运行,如下所示: 导入系统 print "python 版本: ", sys.version_info

有人有什么想法吗?我看到一些参考资料暗示这是一个 64 位问题。 - 戴夫

I have been developing under Python/Snowleopard happily for the part 6 months. I just upgraded Python to 2.6.5 and a whole bunch of libraries, including psycopg2 and Turbogears. I can start up tg-admin and run some queries with no problems. Similarly, I can run my web site from the command line with no problems.

However, if I try to start my application under Aptana Studio, I get the following exception while trying to import psychopg2:

('dlopen(/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so, 2): Symbol not found: _PQbackendPID\n Referenced from: /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so\n Expected in: flat namespace\n in /Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/psycopg2/_psycopg.so',)

This occurs after running the following code:
try:
import psycopg2 as psycopg
except ImportError as ex:
print "import failed :-( xxxxxxxx = "
print ex.args

I have confirmed that the same version of python is being run as follows:
import sys
print "python version: ", sys.version_info

Does anyone have any ideas? I've seem some references alluding to this being a 64-bit issue.
- dave

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

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

发布评论

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

评论(1

烟沫凡尘 2024-09-23 05:00:25

问题解决了(在某种程度上)。我从 Aptana Studio 运行 64 位 python,在命令行上运行 32 位 python。通过强制 Aptana 使用 32 位 python,库再次工作,一切都很顺利。

Problem solved (to a point). I was running 64 bit python from Aptana Studio and 32 bit python on the command line. By forcing Aptana to use 32 bit python, the libraries work again and all is happy.

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