Skip to content

Instantly share code, notes, and snippets.

@douglasmiranda
Last active October 3, 2015 01:27
Show Gist options
  • Save douglasmiranda/2362332 to your computer and use it in GitHub Desktop.
Save douglasmiranda/2362332 to your computer and use it in GitHub Desktop.
Solving troubles with PIL ( Python Imaging Library ). When I'm installing it on my ubuntu. (Support jpeg)
# Download
wget http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
tar zxf PIL-1.1.7.tar.gz
cd PIL-1.1.7
# Create symbolic links to libs
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/
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/
# Edit setup file
vim setup.py
# Set the following variables
JPEG_ROOT = '/usr/lib','/usr/include'
ZLIB_ROOT = '/lib','/usr/include'
# build PIL
python2.7 setup.py build_ext -i
# Tah-dah
# --- ...
# --- JPEG support ok
# --- ...
# If you want to be sure, just run the tests
python selftest.py
# Install
python setup.py install
#PS: in ubuntu 12 I have some troubles, then I just install these (before I build and install):
#PNG Support
#If you want PNG support, you need to have the zlib library installed.
sudo apt-get install zlib1g
sudo apt-get install zlib1g-dev
#JPEG Support
#JPEG requires libjpeg62
sudo apt-get install libjpeg62
sudo apt-get install libjpeg62-dev
#TrueType Support
#You'll need the libfreetype6 package installed
sudo apt-get install libfreetype6
sudo apt-get install libfreetype6-dev
##################################################################################################
#OR:
sudo apt-get install libjpeg-dev
pip uninstall PIL
pip install pillow
# :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment