The simplest way should be the following:
sudo apt-get install python-imaging
if you need to install in virtualenv or want to use the absolute latest version. Install some pilot needs first, and then run pip installation:
sudo apt-get install libjpeg-dev libjpeg62 libjpeg62-dev zlib1g-dev libfreetype6 libfreetype6-dev pip install PIL
To respond to the comment below. If you take a new installation of ubuntu 12.04 and run apt-get install python-imaging , you will have PIL installed correctly on your system. on my ubuntu 12.04 box when running selftest.py I get the following output:
-------------------------------------------------------------------- PIL 1.1.7 TEST SUMMARY -------------------------------------------------------------------- Python modules loaded from /usr/lib/python2.7/dist-packages/PIL Binary modules loaded from /usr/lib/python2.7/dist-packages/PIL -------------------------------------------------------------------- --- PIL CORE support ok *** TKINTER support not installed --- JPEG support ok --- ZLIB (PNG/ZIP) support ok --- FREETYPE2 support ok --- LITTLECMS support ok --------------------------------------------------------------------
The PNG support you are looking for shows how good it is. I suspect your python installation is probably in some kind of damaged state. Perhaps your link or other attempts to install this package ruined your installation. There are three recommendations I can give to correct this situation.
Solutions
- reinstall ubuntu on the machine. This should definitely work.
- create python virtualenv and then set the PIL there using pip. This may work depending on how corrupt the underlying python system is. The idea here is that virtualenv will by default create a new python environment in which there is only a standard library.
- restore your installation on python. You can try
apt-get purge python-imaging and then reinstall the python image package.
source share