“...无法弄清楚...的架构类型”使用 gcc 编译 Python C 扩展时出现问题
我刚刚从 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您似乎使用的是 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 2.7.2 的 64 位/32 位安装程序,而不是仅 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.我试图在 Mac OS X 10.7 上安装 pynauty,但遇到了这个问题。由于某些原因,内德·戴利的回答对我没有帮助。我只是想提供另一种方法来解决这个问题,以防有人来到此页面并且遇到与我相同的情况。我解决这个问题的方法是:
在运行“python setup.py build”之前,运行:
导出 ARCHFLAGS="-arch x86_64"
I was trying to install pynauty on my Mac OS X 10.7 and I got this problem. For some reasons, Ned Deily's answer didn't help me. I just want to provide one more way to solve this problem in case someone come to this page and is in the same situation as I am. The way I solved this prolem is:
Before running "python setup.py build", run:
export ARCHFLAGS="-arch x86_64"
在 travis 上,我遇到了这个错误。我一直在使用 osx_image: osx10.11 ,但在过去几周内它突然停止工作,并出现此错误。更改为 osx_image: xcode7.3 为我修复了错误。
On travis, I was getting this error. I've been using
osx_image: osx10.11
since forever, but it suddenly stopped working, with this error, in last ~few weeks. Changing toosx_image: xcode7.3
fixed the error for me.