我正在尝试将 psycopg2 安装到 Mac OS 10.6.3 上;它声称找不到“stdarg.h”但我可以看到它就在那里;我应该怎么办?
我拼命尝试成功安装 psycopg2 但不断遇到错误。最新的似乎涉及它没有找到“stdarg.h”(参见下面的代码)。但是我可以用自己的眼睛看到 /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h 中存在一个名为 stdarg.h 的文件(它声称找不到任何内容),所以我不知道该怎么办。
我正在运行 Mac OS 10.6.3,在过去的几天里,我确保我拥有所有最新的操作系统开发工具。
我有 Python 2.6.2 和 PostgreSQL 8.4(如果这有什么区别的话)。
python setup.py install
running install
running build
running build_py
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.3-fat-2.6
creating build/temp.macosx-10.3-fat-2.6/psycopg
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.2.1 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I. -I/opt/local/include/postgresql84 -I/opt/local/include/postgresql84/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.3-fat-2.6/psycopg/psycopgmodule.o
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from psycopg/psycopgmodule.c:27:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from psycopg/psycopgmodule.c:27:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/MQ/MQ-tWOWWG+izzuZCrAJpzk+++TI/-Tmp-//ccakFhRS.out
error: command 'gcc' failed with exit status
I'm desperately trying to successfully install psycopg2 but keep running into errors. The latest one seems to involve it not being to find "stdarg.h" (see code below). However I can see with my own eyes that a file called stdarg.h exists at /Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h (where it claims it can't find anything) so I've no idea what to do about it.
I'm running Mac OS 10.6.3 and within the last few days I've made sure I have all the latest OS developer tools.
I have Python 2.6.2 and PostgreSQL 8.4 if that makes any difference.
python setup.py install
running install
running build
running build_py
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.3-fat-2.6
creating build/temp.macosx-10.3-fat-2.6/psycopg
gcc -arch ppc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -O3 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.2.1 (dt dec ext pq3)" -DPG_VERSION_HEX=0x080404 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -DHAVE_PQPROTOCOL3=1 -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I. -I/opt/local/include/postgresql84 -I/opt/local/include/postgresql84/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.3-fat-2.6/psycopg/psycopgmodule.o
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from psycopg/psycopgmodule.c:27:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
In file included from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/unicodeobject.h:4,
from /Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/Python.h:85,
from psycopg/psycopgmodule.c:27:
/Developer/SDKs/MacOSX10.4u.sdk/usr/include/stdarg.h:4:25: error: stdarg.h: No such file or directory
lipo: can't figure out the architecture type of: /var/folders/MQ/MQ-tWOWWG+izzuZCrAJpzk+++TI/-Tmp-//ccakFhRS.out
error: command 'gcc' failed with exit status
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我不知道您的具体问题,但我建议您使用 macports 安装它。
安装 psycopg2 非常简单:
I don't know your specific problem but i recommend you to install it using macports.
Installing psycopg2 is as simply as:
以下内容对我有用:
$ mkvirtualenv --no-site-packages --distribute psycopg2_test
$ cd $VIRTUAL_ENV
$ pip install psycopg2
注释
上述命令利用:
pip
virtualenvwrapper
virtualenv
我通过以下方式引导
pip
:wget http://python-distribute.org/distribute_setup.py
python allocate_setup.py
easy_install pip
更新:我意识到这看起来像是很多牦牛剃毛,但学习如何使用
virtualenv
和朋友是一项前期投资,回报很快,尤其是当处理有很多依赖项的项目时。The following works for me:
$ mkvirtualenv --no-site-packages --distribute psycopg2_test
$ cd $VIRTUAL_ENV
$ pip install psycopg2
Notes
The above commands make use of:
pip
virtualenvwrapper
virtualenv
I bootstrapped
pip
via the following:wget http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip
UPDATE: I realize it seems like a lot of yak shaving, but learning how to use
virtualenv
and friends is an up-front investment that pays off pretty quickly, especially when dealing with projects that have a lot of dependencies.我实际上遇到了与此非常相似的问题(除了 OSX Lion、Python 2.7) 无法在 virtualenv 中安装 psycopg2“错误:stdarg.h:没有这样的文件或目录”。
我最终使用了这个解决方案: https://stackoverflow.com/a/8834568/396327
基本上,卸载/重新安装 XCode从头开始(还有一些技巧可以让它识别 gcc-4.2)。
I actually had a very similar problem as this (except with OSX Lion, Python 2.7) Can't install psycopg2 in virtualenv "error: stdarg.h: No such file or directory".
I ended up using this solution: https://stackoverflow.com/a/8834568/396327
Basically, uninstalling/reinstalling XCode from scratch (and a few more hacks to get it to recognize gcc-4.2).