【问题标题】:Can't compile PIL in Virtualenv无法在 Virtualenv 中编译 PIL
【发布时间】:2014-04-30 15:01:38
【问题描述】:

最新的 pip 1.5 和 Xcode 5.1 使得在 virtualenv 中安装 PIL 变得很困难。 我搜索了各种解决方案,看来我必须执行这两行:

export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
pip install PIL --allow-external PIL --allow-unverified PIL

但是我仍然遇到异常,我不知道为什么。我在另一台机器上的同事对此没有任何问题。

我已经使用命令行工具安装了 Python 和最新的 Xcode。也许后者已损坏?

clang: warning: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]

clang: note: this will be a hard error (cannot be downgraded to a warning) in the future

clang: warning: argument unused during compilation: '-mno-fused-madd'

In file included from _imaging.c:75:

In file included from /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:19:

In file included from /usr/bin/../lib/clang/5.1/include/limits.h:38:

/usr/include/limits.h:63:10: fatal error: 'sys/cdefs.h' file not found

#include <sys/cdefs.h>

         ^

1 error generated.

error: command 'clang' failed with exit status 1

【问题讨论】:

    标签: python xcode macos clang python-imaging-library


    【解决方案1】:

    尝试将这些添加到您的 .profile 中

    export CFLAGS=-Qunused-arguments
    export CPPFLAGS=-Qunused-arguments
    

    【讨论】:

    • 我可以在终端中执行它们还是真的必须在 .profile 中?如果后者是真的,请问我在哪里可以找到 .profile?谢谢
    • 您可以在运行 pip install 之前执行它们。但是如果你想将它们添加到你的 .profile 中,只需 cd ~ 然后 vim .profile 添加
    • 优秀。我刚试过,但错误仍然存​​在。 :( 我错过了什么?
    • 我上个月也遇到了同样的问题,很折磨人。我必须格式化我的 Mac。但你不应该,我建议卸载命令行工具,然后重新安装以尝试新鲜。也退出你的终端,在你尝试 pip install PIL 之前打开它。确保运行这两个导出命令。
    • 非常感谢,卸载并重新安装命令行工具解决了问题。
    猜你喜欢
    • 2012-05-07
    • 1970-01-01
    • 1970-01-01
    • 2011-09-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-04-09
    相关资源
    最近更新 更多