Friday, October 9, 2015

Properly install PIL or Pillow on Ubuntu

After installing PIL or Pillow on ubuntu server you notice that it doesnt have support for png, jpg, and freetype fonts.
It's because it's missing the lib files that it compiles against. Run these to get full support for those types.
sudo apt-get install libjpeg-dev
sudo apt-get install libpng-dev
After they installed you have to make sure they are linked/installed properly into /usr/lib. It never did for me so I run these commands.
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
With that out of the way you are ready now to install PIL or Pillow and have full png, jpg and freetype support. To do that run this command.
sudo pip install Pillow

You can find me on twitter @LZAntal