使用gcc编译Python C-extension时"......无法弄清楚......的架构类型"问题

c00*_*ter 10 gcc python-c-extension osx-lion

我刚刚从Snow Leopard升级到Lion,而我必须更新的旧python c扩展程序不想正确编译.我真的不知道该怎么做.任何可以帮助我的人都可以编译好吗?它在Snow Leopard中编译得很好.

Home:folder Me$ python setup.py build
running build
running build_ext
building 'ccookies' extension
gcc -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c ccookies.c -o build/temp.macosx-10.3-fat-2.7/ccookies.o
llvm-gcc-4.2: error trying to exec '/Developer/usr/bin//../llvm-gcc-4.2/bin/powerpc-apple-darwin11-llvm-gcc-4.2': execvp: No such file or directory
In file included from /usr/include/architecture/i386/math.h:630,
                 from /usr/include/math.h:28,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/pyport.h:312,
                 from /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:58,
                 from ccookies.c:5:
/usr/include/AvailabilityMacros.h:109:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.
lipo: can't figure out the architecture type of: /var/folders/_t/yg4wppss5fv6dkmh89_6ykm40000gn/T//cc3Cgr3v.out
error: command 'gcc' failed with exit status 255
Run Code Online (Sandbox Code Playgroud)

Ned*_*ily 9

您似乎使用的是32位Python 2.7,可能是从python.org安装的.由于Xcode 4的变化(不再支持10.4u SDK和gcc-4.0),在10.7 Lion上使用Python构建C扩展模块是不切实际的.使用Apple提供的Python 2.7(/usr/bin/python2.7)或安装python.org 64位/ 32位安装程序 2.7.2而不是32位安装程序.