Error for pip install Pillow on Ubuntu virtualenv

后端 未结 9 736
别跟我提以往
别跟我提以往 2020-12-07 20:32

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 e

相关标签:
9条回答
  • 2020-12-07 20:57

    You might need to install the python development headers.

    sudo apt-get install build-dep python-imaging
    
    0 讨论(0)
  • 2020-12-07 21:01

    Ubuntu 16.04 virtualenv

    pip install pillow==2.9.0
    
    0 讨论(0)
  • 2020-12-07 21:02

    I had the same headache too...

    The solution was found after reading docs, that says:

    Starting from version 3.0.0 Pillow needs libjpeg...

    So try the previous one:

    pip install pillow==2.9.0
    

    (It works for python 2.6 and above)

    Good Luck!

    0 讨论(0)
  • 2020-12-07 21:02

    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:

    pip install Pillow==2.9.0
    

    This should work also in Ubuntu, I use Elementary OS.

    0 讨论(0)
  • 2020-12-07 21:05

    Finally I have found the answer to this headache!

    It turns out I have two flag settings in my .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.

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

    Thanks everyone for the help.

    0 讨论(0)
  • 2020-12-07 21:05

    On Fedora, installing rpm-build solved it for me. Make sure you have python-devel and libjpeg-devel installed too.

    0 讨论(0)
提交回复
热议问题