简体   繁体   中英

Error installing Pillow (and PIL)

If i use the command sudo pip install Pillow , it runs fine until the cleaning up stage: (this is the full error message from the log file)

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

I have the xcode command line tools installed. Really stuck on this one.

----UPDATE---- Ran brew doctor and cleared all errors. Installed all Pillow prerequisites successfully.

Here is the fill pip.log file: http://pastebin.com/08XD9JjM

I got the same problem. It seems to be a problem caused by clang with Xcode 5.1. Look at the answer of this question:

OS X Pillow installation error

My problem is solved by using the command in that answer:

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

It throws a lot of warnings. But everything is fine.

EDIT: It looks like this is a known issue for Mac OS X, either relating to XCode 5.1 or Mavericks 10.9: https://github.com/python-imaging/Pillow/issues/527

This appears to be the most non-invasive way to resolve the issue:

I was having this same problem and found that setting "CFLAGS=-Qunused-arguments" and "CPPFLAGS=-Qunused-arguments" resolved my issue (I didn't want to have to do a clean install to resolve it). This fix is described here: Ansible Installation -clang: error: unknown argument: '-mno-fused-madd'


Original answer:

It looks like you're attempting to install Pillow on Mac OS X. Have you installed all the prerequisites, per Pillow's Mac OS X installation instructions ?

pip should have written more output about the compilation error, if not to the console, then to its log file. You should have a look at the log file and post the relevant compilation error messages in your question, as well, to help with determining the issue.

Found a solution:

brew install python

After running brew doctor it showed that due to the new installation there were unlinked kegs. To correct this i had to run brew link --overwrite python .

i could then run sudo pip install Pillow without any problems.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM