Thursday, May 24, 2012

Installing Python Imaging Library(PIL) on ubuntu

Install required packages
sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev python-dev
Fixing the lib path
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib
Install the PIL
pip install pil
If getting "ImportError: No module named PIL" on importing Image module also try
from PIL import Image

If not using virtualenv "$ sudo apt-get install python-imaging" will also install pil for the system.

1 comment: