How to install PIL on CentOS6.4 (64bit) + virtualenv

Posted: January 14, 2013


When I upload image file on Mezzanine, I got error message like below

decoder jpeg not availableGo

Goddxxn!

Install PIL

The pill (*1) is expensive in Japan, but this PIL is totally free 😃

From the info below article, we need 3 steps.

1) Install libjpeg
2) Install PIL via pip
- 2-1) At first, just download PIL using PIP
- 2-2) Add 64bit libs path to config file
- 2-3) Install PIL using the config file
3) Restart the apps

Install PIL on virtualenv

# (1)
sudo yum install libjpeg-turbo-devel

# make sure no PIL
$YOUR_PROJECT_PATH/bin/pip uninstall PIL
# (2-1)
$YOUR_PROJECT_PATH/bin/pip install PIL --no-install
# (2-2)
vim $YOUR_PROJECT_PATH/build/PIL/setup.py
diff $YOUR_PROJECT_PATH/build/PIL/setup.py

214d213
<         add_directory(library_dirs, "/usr/lib64")

# (2c)
$YOUR_PROJECT_PATH/bin/pip install PIL --no-download

# (3) Change command for your own app servers
sudo initctl reload uwsgi

Then I could upload image files on Mezzanine…?

[*1]: When we say pill, it means birth control pill