2012-04-26 83 views
1

注意:在使用时的easy_install安装的其他方式也会发生同样的错误......无法安装在virtualenv中psycopg2“错误:STDARG.H:没有这样的文件或目录”

我面对几乎与I'm trying to install psycopg2 onto Mac OS 10.6.3; it claims it can't find "stdarg.h" but I can see it's there; what should I do?完全相同的问题,除了我在OSX Lion(10.7)和我在Python v2.7上。

它也似乎与Can't install psycopg2 with pip in virtualenv on Mac OS X 10.7有关,但我收到了不同的错误消息。

我提出了一个新问题,因为解决方案适用于OSX 10.6(例如http://mail.python.org/pipermail/pythonmac-sig/2009-September/021617.html)不适用于我。

我想在Heroku上执行Django的教程(https://devcenter.heroku.com/articles/django), ,我遇到了一个尝试安装psycopg2的错误。这里的痕迹:

Downloading/unpacking psycopg2 
    Running setup.py egg_info for package psycopg2 

    no previously-included directories found matching 'doc/src/_build' 
Installing collected packages: psycopg2 
    Running setup.py install for psycopg2 
    building 'psycopg2._psycopg' extension 
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090005 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.6-intel-2.7/psycopg/psycopgmodule.o 
    In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4, 
        from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85, 
        from ./psycopg/psycopg.h:30, 
        from psycopg/psycopgmodule.c:27: 
    /Developer/SDKs/MacOSX10.6.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.7/include/python2.7/unicodeobject.h:4, 
        from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85, 
        from ./psycopg/psycopg.h:30, 
        from psycopg/psycopgmodule.c:27: 
    /Developer/SDKs/MacOSX10.6.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/tmp//ccHla8Gp.out 
    error: command 'gcc-4.2' failed with exit status 1 
    Complete output from command /Users/AndyFang/Desktop/code/venv/bin/python -c "import setuptools;__file__='/Users/AndyFang/Desktop/code/venv/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-ONvqYm-record/install-record.txt --install-headers /Users/AndyFang/Desktop/code/venv/bin/../include/site/python2.7: 
    running install 

running build 

running build_py 

running build_ext 

building 'psycopg2._psycopg' extension 

gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -isysroot /Developer/SDKs/MacOSX10.6.sdk -arch i386 -arch x86_64 -g -O2 -DNDEBUG -g -O3 -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4.5 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090005 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I. -I/usr/include -I/usr/include/postgresql/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.6-intel-2.7/psycopg/psycopgmodule.o 

In file included from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/unicodeobject.h:4, 

       from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85, 

       from ./psycopg/psycopg.h:30, 

       from psycopg/psycopgmodule.c:27: 

/Developer/SDKs/MacOSX10.6.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.7/include/python2.7/unicodeobject.h:4, 

       from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:85, 

       from ./psycopg/psycopg.h:30, 

       from psycopg/psycopgmodule.c:27: 

/Developer/SDKs/MacOSX10.6.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/tmp//ccHla8Gp.out 

error: command 'gcc-4.2' failed with exit status 1 

---------------------------------------- 
Command /Users/AndyFang/Desktop/code/venv/bin/python -c "import setuptools;__file__='/Users/AndyFang/Desktop/code/venv/build/psycopg2/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-ONvqYm-record/install-record.txt --install-headers /Users/AndyFang/Desktop/code/venv/bin/../include/site/python2.7 failed with error code 1 in /Users/AndyFang/Desktop/code/venv/build/psycopg2 
Storing complete log in /Users/AndyFang/.pip/pip.log 

我不知道它为什么找不到stdarg.h!我在网上查了很多答案,都没有用。

回答

3

它看起来像你有一个破碎的构建环境。 stdarg.h是核心gcc头文件的一部分。在我的(Fedora 16 Linux)系统上,stdarg.h位于/usr/lib/gcc/x86_64-redhat-linux/4.6.2/include/stdarg.h,是gcc包的一部分。

在苹果平台上,我希望它随Xcode一起提供。猜测,你有多个编译器/工具链安装,他们的包含路径越来越混乱。我建议彻底卸载XCode及其所有朋友,删除相关目录以摆脱落后者,然后重新安装。

+0

我结束了使用此解决方案:http://stackoverflow.com/a/8834568/396327 – fangsterr 2012-04-26 20:11:59

相关问题