“...无法弄清楚...的架构类型”使用 gcc 编译 Python C 扩展时出现问题

发布于 2024-11-26 12:58:55 字数 1354 浏览 3 评论 0 原文

我刚刚从 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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

亢潮 2024-12-03 12:58:55

您似乎使用的是 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.

雾里花 2024-12-03 12:58:55

我试图在 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"

坦然微笑 2024-12-03 12:58:55

在 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 to osx_image: xcode7.3 fixed the error for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文