【问题标题】:Failed to build PIL on Mac OS X 10.7 Lion在 Mac OS X 10.7 Lion 上构建 PIL 失败
【发布时间】:2011-09-19 16:03:50
【问题描述】:

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

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。

【问题讨论】:

    标签: python macos operating-system python-imaging-library osx-lion


    【解决方案1】:

    您似乎正在使用仅 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 的最新版本),要么在 10.7 中使用 Apple 提供的系统 Python(/usr/bin/python,默认为 2.7.1)。

    【讨论】:

    • 谢谢,你是对的。我试图使用来自 python.org 的 Python 2.6,因为内置版本的 py2app + wxWidgets 存在问题。我将不得不尝试一些不同的东西。
    猜你喜欢
    • 1970-01-01
    • 2013-02-12
    • 1970-01-01
    • 1970-01-01
    • 2011-10-20
    • 1970-01-01
    • 1970-01-01
    • 2012-06-09
    • 1970-01-01
    相关资源
    最近更新 更多