在 Mac OS X 10.7 Lion 上构建 PIL 失败 [英] Failed to build PIL on Mac OS X 10.7 Lion

查看:44
本文介绍了在 Mac OS X 10.7 Lion 上构建 PIL 失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在 Mac OS X 10.7 上构建 PIL 1.1.7,我收到此错误:

I am tying to build PIL 1.1.7 on Mac OS X 10.7, I am getting this error:

running build
running build_py
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -DHAVE_LIBZ -I/System/Library/Frameworks/Tcl.framework/Headers -I/System/Library/Frameworks/Tk.framework/Headers -IlibImaging -I/opt/local/include -I/Library/Frameworks/Python.framework/Versions/2.6/include -I/usr/include -I/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c _imaging.c -o build/temp.macosx-10.3-fat-2.6/_imaging.o
unable to execute gcc-4.0: No such file or directory
error: command 'gcc-4.0' failed with exit status 1

我安装了最新的 Xcode.gcc-4.0 不存在,但 gcc-4.2 存在.我不知道它为什么要尝试使用 gcc-4.0.

I have the latest Xcode installed. gcc-4.0 does not exist but gcc-4.2 does. I don't know why it's trying to use gcc-4.0.

推荐答案

您似乎使用的是仅 32 位的 Python,可能是从 python.org 下载的.它们是用 gcc-4.0 和 i386 和 ppc 架构构建的,以兼容多个 OS X 版本.在构建 C 扩展模块时,Python 的 Distutils 将尝试使用与 Python 本身构建时相同的编译器版本和选项.由于 Xcode 4 和 OS X 10.7 不再包含 gcc-4.0 和对 ppc 架构的支持,因此如果您需要构建扩展模块,则不应在 10.7 上使用仅 32 位构建.安装 64 位/32 位版本的 Python(2.7.2 和 3.2.2 来自 python.org)或使用 Apple 提供的 10.7 系统 Python(/usr/bin/python 默认为 2.7.1).

You appear to be using a 32-bit-only Python possibly one downloaded from python.org. They are built with gcc-4.0 and for the i386 and ppc archs for compatibility with multiple OS X versions. When building a C extension module, Python's Distutils will attempt to use the same compiler version and options that Python itself was build with. Because gcc-4.0 and support for the ppc architecture are no longer included with Xcode 4 and OS X 10.7, you should not use the 32-bit-only builds on 10.7 if you need to build extension modules. Either install a 64-bit/32-bit version of Python (2.7.2 and 3.2.2 are current from python.org) or use the Apple-supplied system Pythons in 10.7 (/usr/bin/python which defaults to 2.7.1).

这篇关于在 Mac OS X 10.7 Lion 上构建 PIL 失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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