Friday, May 27, 2016

Python install PIL (Python Imaging Library) && IOError


Python install PIL (Python Imaging Library) && IOError: der jpeg not available
So you get PIL(Python Imaging Library) all installed on your new system and you’re feeling proud of yourself. But then you go to do some tasks involving JPEG’s and you get this horriffic error:

IOError: der jpeg not available

Here’s how to uninstallation PIL
On Kali Linux precise, PIL doesn't find the jpeg library files, even once they are installed. The siest way to fix this is to make a symlink after you have installed the jpeg dev package. So, I needed an extra step:

$ pip uninstall PIL

Make sure you install at the libraries for both JPEG support and FreeType2:
$ sudo aptitude install libjpeg libjpeg-dev
$ sudo aptitude install libfreetype6 libfreetype6-dev
$ sudo apt-get install libjpeg8-dev
$ sudo apt-get install libjpeg62-dev zlib1g-dev libfreetype6-dev liblcms1-dev

Get PIL again and do the install:

for x64 OS

$ 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/
$ pip install PIL

for x32 OS

$ sudo ln -s /usr/lib/i386-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/
$ pip install PIL

No comments:

Post a Comment