I'm not having much luck using Pillow with Python 3.3.2 and I'd be grateful for some help. My problem is that after installing Pillow, I can't import Image.
My setup: I've got Linux Mint 16 installed (on an HP Pavilion dv7 laptop). I've got Python 3.3.2+ installed, and it's working fine. I've got Python 2.7.5+ installed, and it's working fine.
What I did: I followed the instructions at http://pillow.readthedocs.org/en/latest/index.html to install Pillow v2.4.0 (PIL fork):
I started with:
~$ pip install Pillow
I installed python-setuptools with:
~$ sudo apt-get install python-dev python-setuptools
and also, for python 3:
~$ sudo apt-get install python3-dev python3-setuptools
I installed "prerequisites on Ubuntu 12.04 LTS" thus:
~$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk
(Mint 16 is based on Ubuntu 13.10, but I didn't find a list of prerequisites for any later version)
What happened: With python 2, import image worked and I could open a .png image and show it. But with python 3, 'import image' gave 'no module named Image' and 'from PIL import Image' gave 'no module named PIL'
Any help would be much appreciated.
\AppData\Local\Temp\pip-install-dmx24pn4\Pillow\setup.py:29: RuntimeWarning: Pillow does not yet support Python 3.8 and does not yet provide prebuilt Windows binaries. We do not recommend building from source on Windows.
To load the image, we simply import the image module from the pillow and call the Image. open(), passing the image filename. Instead of calling the Pillow module, we will call the PIL module as to make it backward compatible with an older module called Python Imaging Library (PIL).
After much digging, and since there's been no other answer forthcoming, I'll answer my own question. This works for the pillow installation for python3.4:
$ sudo apt-get install python3-dev python3-setuptools
$ sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev \
libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk
$ sudo apt-get install python3-pip
$ sudo pip3 install Pillow
$ sudo apt-get install imagemagick
$ sudo ln -s /usr/bin/display /usr/bin/xv
Then in the python3.4 interactive shell enter:
>>> from PIL import Image
>>> im = Image.open("someimage.jpg")
>>> im.show()
And voilá, the image appears!
Most helpful sites:
http://pillow.readthedocs.org/en/latest/installation.html
https://askubuntu.com/questions/427358/install-pillow-for-python-3
Python 3 is a beautiful language, and it's getting there, but installing and using its imaging library shouldn't be so hard to do!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With