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)
我有一个ec2实例,最初在我的virtualenv中安装了枕头2.0。不知何故,当我试图将它升级到Pillow 2.5时,它以以下消息失败。即使我在重新安装之前完全移除枕头,错误也是一样的。(所以现在我再也没有枕头了)
$ 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
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.
我不知道这是否相关,但是有很多gcc: error: build/temp.linux-x86_64-2.7/_imaging。o:日志中没有这样的文件或目录错误。还有很多gcc: error: unoption ' -Qunused-arguments '也是。
I am able to install Pillow 2.5 with my root access though, but then the it will not be installed in my virtualenv.
我可以安装枕头2.5与我的根访问,但它将不会安装在我的虚拟机。
sudo pip install Pillow # this works but wrong directory
pip install -I Pillow==2.0 # gives the same error and would not install
Versions
版本
PIP: 1.5.4
皮普:1.5.4
Linux: Ubuntu 12.04.4 LTS (all package upgraded)
Linux: Ubuntu 12.04.4 LTS(全部包升级)
Thank you
谢谢你!
9 个解决方案
#1
81
My case was slightly different as my ubuntu 15.04 was missing also libjpeg, so the installation failed each time. Apparently sometimes pillow can not find required library and the easiest way to fix it is to install the dev version and link it to the user libs.
我的情况稍有不同,因为我的ubuntu 15.04也缺少libjpeg,所以每次安装都失败。显然,pillow有时找不到所需的库,最简单的解决办法是安装dev版本并将其链接到用户libs。
sudo apt-get install python-dev
sudo apt-get install libjpeg8-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
pip install pillow
Partial solution found here
部分解决方案在这里找到
#2
39
Note for myself and any others, getting this to compile on Elementary OS Luna (Ubuntu 12.04) requires installation of the python headers you need for your virtualenv python version per the comments on the OP. I am using the default python version and testing 3.4 (via deadsnakes ppa) so for me this was:
注意自己和他人,这对基本操作系统编译Luna(Ubuntu 12.04)要求安装python头你需要virtualenv python版本的评论相机会我使用默认的python版本3.4和测试(通过deadsnakes ppa)这对我来说是:
sudo apt-get install python-dev
sudo apt-get install python3.4-dev
BUT! I was still getting the same error! I checked my .bashrc per the OPs answer, I didn't have any matching exports. Then it hit me, I'd been troubleshooting for a while and from an answer somewhere else I had tried setting those and hadn't restarted bash.
但是!我还是得到了同样的错误!我检查了。bashrc对于OPs的答案,我没有任何匹配的导出。然后我突然意识到,我已经进行了一段时间的故障排除,并且从其他地方的一个答案开始,我尝试设置这些,但没有重新启动bash。
So don't forget to restart (or re-source I suppose) bash to make sure your exports match .bashrc!
因此,不要忘记重新启动(或者重新源代码)bash,以确保导出与.bashrc匹配!
edit: This is a bit long for a comment but not really an answer. Will modify if necessary.
编辑:这是一个有点长的评论,但不是一个真正的答案。必要时将修改。
#3
23
I had the same headache too...
我也有同样的头痛……
The solution was found after reading docs, that says:
这个解决方案是在阅读完文档后找到的,上面写着:
Starting from version 3.0.0 Pillow needs libjpeg...
从3.0.0版本开始,需要libjpeg…
So try the previous one:
所以试试前一个:
pip install pillow==2.9.0
(It works for python 2.6 and above)
(适用于python 2.6及以上版本)
Good Luck!
好运!
#4
10
The new version 3.0 doesn't work, we need to install the 2.9.0 version which works with Django. Do this while inside the virtual environment:
新版本3.0不工作,我们需要安装2.9.0版本,该版本与Django兼容。在虚拟环境中这样做:
pip install Pillow==2.9.0
This should work also in Ubuntu, I use Elementary OS.
这在Ubuntu中也可以用,我用的是基本操作系统。
#5
8
Finally I have found the answer to this headache!
我终于找到了这个头痛的答案!
It turns out I have two flag settings in my .bashrc
:
我的。bashrc中有两个标志设置:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
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.
bashrc是从我的Macbook Pro中复制的,这两个标志是XCODE需要使用的。看来他们会在Linux中崩溃。
After removing these two flags, pip install Pillow
works as expected.
移除这两种标志后,pip安装枕头可以正常工作。
Thanks everyone for the help.
谢谢大家的帮助。
#6
4
Ubuntu 16.04 virtualenv
Ubuntu 16.04 virtualenv
pip install pillow==2.9.0
#7
2
You might need to install the python development headers.
您可能需要安装python开发头。
sudo apt-get build-dep python-imaging
#8
0
On Fedora, installing rpm-build
solved it for me. Make sure you have python-devel
and libjpeg-devel
installed too.
在Fedora上,安装rpm-build为我解决了这个问题。确保也安装了python-devel和libjpeg-devel。
#9
0
On my CentOS machine I had to:
在我的CentOS机器上,我不得不:
yum install python-devel
#1
81
My case was slightly different as my ubuntu 15.04 was missing also libjpeg, so the installation failed each time. Apparently sometimes pillow can not find required library and the easiest way to fix it is to install the dev version and link it to the user libs.
我的情况稍有不同,因为我的ubuntu 15.04也缺少libjpeg,所以每次安装都失败。显然,pillow有时找不到所需的库,最简单的解决办法是安装dev版本并将其链接到用户libs。
sudo apt-get install python-dev
sudo apt-get install libjpeg8-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
pip install pillow
Partial solution found here
部分解决方案在这里找到
#2
39
Note for myself and any others, getting this to compile on Elementary OS Luna (Ubuntu 12.04) requires installation of the python headers you need for your virtualenv python version per the comments on the OP. I am using the default python version and testing 3.4 (via deadsnakes ppa) so for me this was:
注意自己和他人,这对基本操作系统编译Luna(Ubuntu 12.04)要求安装python头你需要virtualenv python版本的评论相机会我使用默认的python版本3.4和测试(通过deadsnakes ppa)这对我来说是:
sudo apt-get install python-dev
sudo apt-get install python3.4-dev
BUT! I was still getting the same error! I checked my .bashrc per the OPs answer, I didn't have any matching exports. Then it hit me, I'd been troubleshooting for a while and from an answer somewhere else I had tried setting those and hadn't restarted bash.
但是!我还是得到了同样的错误!我检查了。bashrc对于OPs的答案,我没有任何匹配的导出。然后我突然意识到,我已经进行了一段时间的故障排除,并且从其他地方的一个答案开始,我尝试设置这些,但没有重新启动bash。
So don't forget to restart (or re-source I suppose) bash to make sure your exports match .bashrc!
因此,不要忘记重新启动(或者重新源代码)bash,以确保导出与.bashrc匹配!
edit: This is a bit long for a comment but not really an answer. Will modify if necessary.
编辑:这是一个有点长的评论,但不是一个真正的答案。必要时将修改。
#3
23
I had the same headache too...
我也有同样的头痛……
The solution was found after reading docs, that says:
这个解决方案是在阅读完文档后找到的,上面写着:
Starting from version 3.0.0 Pillow needs libjpeg...
从3.0.0版本开始,需要libjpeg…
So try the previous one:
所以试试前一个:
pip install pillow==2.9.0
(It works for python 2.6 and above)
(适用于python 2.6及以上版本)
Good Luck!
好运!
#4
10
The new version 3.0 doesn't work, we need to install the 2.9.0 version which works with Django. Do this while inside the virtual environment:
新版本3.0不工作,我们需要安装2.9.0版本,该版本与Django兼容。在虚拟环境中这样做:
pip install Pillow==2.9.0
This should work also in Ubuntu, I use Elementary OS.
这在Ubuntu中也可以用,我用的是基本操作系统。
#5
8
Finally I have found the answer to this headache!
我终于找到了这个头痛的答案!
It turns out I have two flag settings in my .bashrc
:
我的。bashrc中有两个标志设置:
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
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.
bashrc是从我的Macbook Pro中复制的,这两个标志是XCODE需要使用的。看来他们会在Linux中崩溃。
After removing these two flags, pip install Pillow
works as expected.
移除这两种标志后,pip安装枕头可以正常工作。
Thanks everyone for the help.
谢谢大家的帮助。
#6
4
Ubuntu 16.04 virtualenv
Ubuntu 16.04 virtualenv
pip install pillow==2.9.0
#7
2
You might need to install the python development headers.
您可能需要安装python开发头。
sudo apt-get build-dep python-imaging
#8
0
On Fedora, installing rpm-build
solved it for me. Make sure you have python-devel
and libjpeg-devel
installed too.
在Fedora上,安装rpm-build为我解决了这个问题。确保也安装了python-devel和libjpeg-devel。
#9
0
On my CentOS machine I had to:
在我的CentOS机器上,我不得不:
yum install python-devel