在 Ubuntu virtualenv 上 pip install Pillow 出错 [英] Error for pip install Pillow on Ubuntu virtualenv

查看:34
本文介绍了在 Ubuntu virtualenv 上 pip install Pillow 出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ec2 实例,并且最初在我的 virtualenv 中安装了 Pillow 2.0.不知何故,当我尝试将其升级到 Pillow 2.5 时,它失败并显示以下消息.即使在重新安装之前完全移除 Pillow 后,错误也是相同的.(所以现在我的 virtualenv 中根本没有 Pillow)

I have an ec2 instance and had Pillow 2.0 installed in my virtualenv initially. Somehow when I tried to upgrade it to Pillow 2.5, it failed with the following message. The error is the same even after I removed Pillow completely prior to reinstall. (So now I don't have Pillow in my virtualenv at all)

$ pip install Pillow
....
....
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Qunused-arguments -Qunused-arguments -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -DHAVE_LIBTIFF -I/usr/include/freetype2 -I/home/andycheng/realprice/env/build/pillow/libImaging -I/home/andycheng/realprice/env/include -I/usr/include/tcl8.5 -I/usr/local/include -I/usr/include -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu -c libImaging/RawDecode.c -o build/temp.linux-x86_64-2.7/libImaging/RawDecode.o

gcc: error: unrecognized option ‘-Qunused-arguments’

gcc: error: unrecognized option ‘-Qunused-arguments’

....
....
gcc: error: build/temp.linux-x86_64-2.7/libImaging/XbmEncode.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/ZipDecode.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/ZipEncode.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/TiffDecode.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/Incremental.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/Jpeg2KDecode.o: No such file or directory

gcc: error: build/temp.linux-x86_64-2.7/libImaging/Jpeg2KEncode.o: No such file or directory

gcc: error: unrecognized option ‘-Qunused-arguments’

gcc: error: unrecognized option ‘-Qunused-arguments’

error: command 'gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /home/andycheng/realprice/env/bin/python -c "import setuptools, tokenize;__file__='/home/andycheng/realprice/env/build/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('
', '
'), __file__, 'exec'))" install --record /tmp/pip-U8jA_X-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/andycheng/realprice/env/include/site/python2.7 failed with error code 1 in /home/andycheng/realprice/env/build/Pillow

我不知道这是否相关,但有很多 gcc: error: build/temp.linux-x86_64-2.7/_imaging.o: No such file or directory 错误在日志.还有很多gcc: error: unrecognized option ‘-Qunused-arguments’.

I don't know if this is related but there are a lot of gcc: error: build/temp.linux-x86_64-2.7/_imaging.o: No such file or directory errors in the log. And there are a lot of gcc: error: unrecognized option ‘-Qunused-arguments’ too.

虽然我可以使用 root 访问权限安装 Pillow 2.5,但是它不会安装在我的 virtualenv 中.

I am able to install Pillow 2.5 with my root access though, but then the it will not be installed in my virtualenv.

sudo pip install Pillow  # this works but wrong directory
pip install -I Pillow==2.0  # gives the same error and would not install

版本

画中画:1.5.4

Linux:Ubuntu 12.04.4 LTS(所有软件包都已升级)

Linux: Ubuntu 12.04.4 LTS (all package upgraded)

谢谢

推荐答案

我终于找到了解决这个头疼问题的答案!

Finally I have found the answer to this headache!

事实证明我的 .bashrc 中有两个标志设置:

It turns out I have two flag settings in my .bashrc:

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

.bashrc 是从我的 Macbook Pro 复制的,这两个标志是 XCODE 的一种变通方法.似乎它们会在 Linux 中崩溃.

The .bashrc was copied from my Macbook Pro and these two flags were required as a work around for XCODE. It seems that they will break in Linux.

删除这两个标志后,pip install Pillow 可以正常工作.

After removing these two flags, pip install Pillow works as expected.

感谢大家的帮助.

这篇关于在 Ubuntu virtualenv 上 pip install Pillow 出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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