“......无法弄清......的架构类型”。使用gcc编译Python C扩展时遇到问题 [英] "...can't figure out the architecture type of..." problem when compiling Python C-extension with gcc

查看:335
本文介绍了“......无法弄清......的架构类型”。使用gcc编译Python C扩展时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚从Snow Leopard升级到Lion,并且我不得不更新的旧python c-extension不想正确编译。我真的不知道该在这里做什么。任何人可以帮助我,所以它编译好吗?它在Snow Leopard中编译得很好。

I just upgraded from Snow Leopard to Lion, and an old python c-extension that I had to update didn't want to compile properly. I don't really know what to do here. Anyone who could help me out so it compiles ok? It compiled just fine back in 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


推荐答案

您似乎在使用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位安装程序。

You appear to be using a 32-bit Python 2.7, possibly installed from python.org. Because of changes in Xcode 4 (dropping of support for the 10.4u SDK and gcc-4.0) it is not practical to build C extension modules with that Python on 10.7 Lion. Either use the Apple-supplied Python 2.7 (/usr/bin/python2.7) or install the python.org 64-bit/32-bit installer for 2.7.2 instead of the 32-bit-only one.

这篇关于“......无法弄清......的架构类型”。使用gcc编译Python C扩展时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆