[英]Cannot install psycopg2 on OSX 10.6.7 with XCode4
Trying to install psycopg2 on OSX results in the following: 尝试在OSX上安装psycopg2会导致以下结果:
building 'psycopg2._psycopg' extension
creating build/temp.macosx-10.6-universal-2.6
creating build/temp.macosx-10.6-universal-2.6/psycopg
gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -DPSYCOPG_DEFAULT_PYDATETIME=1 -DPSYCOPG_VERSION="2.4 (dt dec pq3 ext)" -DPG_VERSION_HEX=0x090003 -DPSYCOPG_EXTENSIONS=1 -DPSYCOPG_NEW_BOOLEAN=1 -DHAVE_PQFREEMEM=1 -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I. -I/usr/local/Cellar/postgresql/9.0.3/include -I/usr/local/Cellar/postgresql/9.0.3/include/server -c psycopg/psycopgmodule.c -o build/temp.macosx-10.6-universal-2.6/psycopg/psycopgmodule.o
/usr/libexec/gcc/powerpc-apple-darwin10/4.2.1/as: assembler (/usr/bin/../libexec/gcc/darwin/ppc/as or /usr/bin/../local/libexec/gcc/darwin/ppc/as) for architecture ppc not installed
Installed assemblers are:
/usr/bin/../libexec/gcc/darwin/x86_64/as for architecture x86_64
/usr/bin/../libexec/gcc/darwin/i386/as for architecture i386
psycopg/psycopgmodule.c:1009: fatal error: error writing to -: Broken pipe
compilation terminated.
lipo: can't open input file: /var/folders/zf/zfsYTD29GwSWm+UDcF6VxE+++TM/-Tmp-//ccd8ckcV.out (No such file or directory)
error: command 'gcc-4.2' failed with exit status 1
Does anyone have any idea what can I do to get it installed? 有谁知道我该怎么做才能安装它? I have Postgres installed and it seems to work fine.
我安装了Postgres,似乎工作正常。
I've tried both easy_install and pip install, but both end up with a similar message. 我已经尝试了easy_install和pip安装,但最终都得到了类似的消息。
It seems that there was something wrong with the ARCHFLAGS actually sticking, so finally using: 似乎ARCHFLAGS实际上有问题,所以最后使用:
sudo env ARCHFLAGS="-arch i386 -arch x86_64" pip install psycopg2 sudo env ARCHFLAGS =“ - arch i386 -arch x86_64”pip install psycopg2
actually worked. 实际上工作。
The problem is that the Python 2.6 included with OS X 10.6 was built for three supported architectures (i386, x86_64, and ppc for compatibility with earlier releases of OS X) and Python's Distutils tries to ensure that all C extension modules are built with the same arch
s as the Python interpreter and library. 问题是OS X 10.6附带的Python 2.6是为三种支持的体系结构(i386,x86_64和ppc,以便与早期版本的OS X兼容)构建的,而Python的Distutils试图确保所有C扩展模块都使用相同的构建
arch
s作为Python解释器和库。 But Xcode 4 has apparently removed support for PPC. 但Xcode 4显然已经取消了对PPC的支持。 Until an official patch is available, you can either:
在官方补丁可用之前,您可以:
ARCHFLAGS
is the way to do that) ARCHFLAGS
是这样做的方法) or you could build and install everything you need using a third-party package manager, like MacPorts . 或者您可以使用第三方软件包管理器(如MacPorts)构建和安装所需的一切。
sudo port install py27-psycopg2 # installs Python2.7, portgresql, and pysycopg2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.