Cannot install psycopg2 on OSX 10.6.7 with XCode4

前端 未结 2 1088
没有蜡笔的小新
没有蜡笔的小新 2020-12-05 07:57

Trying to install psycopg2 on OSX results in the following:

building \'psycopg2._psycopg\' extension

creating build/temp.macosx-10.6-universal-2.6

creating         


        
相关标签:
2条回答
  • 2020-12-05 08:15

    It seems that there was something wrong with the ARCHFLAGS actually sticking, so finally using:

    sudo env ARCHFLAGS="-arch i386 -arch x86_64" pip install psycopg2

    actually worked.

    0 讨论(0)
  • 2020-12-05 08:28

    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 archs as the Python interpreter and library. But Xcode 4 has apparently removed support for PPC. Until an official patch is available, you can either:

    • override the archs when running the setup.py script for pyscopg2 (as Adam points out, the Distutils ARCHFLAGS is the way to do that)
    • go back to using Xcode 3 (or try some unsupported hacks for installing Xcode 3 along side of Xcode 4)
    • try using a different Python. For instance, for Python 2.7, python.org provides an installer for an i386/x86_64 Python here
    • or you could build and install everything you need using a third-party package manager, like MacPorts.

      sudo port install py27-psycopg2 # installs Python2.7, portgresql, and pysycopg2
      
    0 讨论(0)
提交回复
热议问题