在Ubuntu virtualenv上进行pip安装枕头时出错 [英] Error for pip install Pillow on Ubuntu virtualenv

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

问题描述

我有一个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('\r\n', '\n'), __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

版本

PIP:1.5.4

PIP: 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安装枕头时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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