Psycopg2 under osx works on commandline but fails in Aptana studio

末鹿安然 提交于 2019-12-11 15:40:02

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/3571495/psycopg2-under-osx-works-on-commandline-but-fails-in-aptana-studio

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!