安装枕头(和PIL)时出错

时间:2014-03-21 16:46:08

标签: python python-imaging-library pillow

如果我使用命令sudo pip install Pillow,它会一直运行到清理阶段:(这是日志文件中的完整错误消息)

clang: error: 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
error: command 'cc' failed with exit status 1

----------------------------------------

Cleaning up...
Removing temporary dir /private/tmp/pip_build_root...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-VaD2jT-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/Pillow
Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/pip/req.py", line 706, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/Library/Python/2.7/site-packages/pip/util.py", line 697, in call_subprocess
% (command_desc, proc.returncode,`enter code here` cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/private/tmp/pip_build_root/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-VaD2jT-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /private/tmp/pip_build_root/Pillow

我安装了xcode命令行工具。真的坚持这一个。

---- ---- UPDATE 跑brew doctor并清除所有错误。成功安装了所有Pillow先决条件。

这是填充pip.log文件:http://pastebin.com/08XD9JjM

3 个答案:

答案 0 :(得分:5)

我遇到了同样的问题。这似乎是由Xcode 5.1铿锵引起的问题。看看这个问题的答案:

OS X Pillow installation error

通过使用该答案中的命令解决了我的问题:

sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install Pillow

它引发了很多警告。但一切都很好。

答案 1 :(得分:0)

编辑:对于Mac OS X来说,这似乎是一个已知问题,与XCode 5.1或Mavericks 10.9相关:https://github.com/python-imaging/Pillow/issues/527

这似乎是解决此问题的最具侵略性的方式:

  

我遇到了同样的问题,发现设置" CFLAGS = -Qunused-arguments"和" CPPFLAGS = -Qunused-arguments"解决了我的问题(我不想做一个干净的安装来解决它)。此修订说明如下:Ansible Installation -clang: error: unknown argument: '-mno-fused-madd'


原始答案:

您似乎正在尝试在Mac OS X上安装Pillow。您是否按Pillow's Mac OS X installation instructions安装了所有先决条件?

pip应该写有关编译错误的更多输出,如果没有写入控制台,则写入其日志文件。您应该查看日志文件并在问题中发布相关的编译错误消息,以帮助确定问题。

答案 2 :(得分:0)

找到解决方案:

brew install python

运行brew doctor后,它显示由于新安装,有未链接的桶。为了纠正这个问题,我必须运行brew link --overwrite python

然后我可以毫无问题地运行sudo pip install Pillow