Installing Python Image Library (PIL) on an x64 system using CentOS as an example
When developers require a lot of python and django of different versions on the same host,
virtualenv comes to the rescue ...
But after that you have to install additional modules for each python with your hands through pip
And here there are nuances. For example, with the PIL library,
it is perfectly installed, but when trying to work with it, it produces such excellent error messages.
The problem is that when building PIL, the library cannot work with jpeg, zlib, tiff, freetype, because in our case they are in / usr / lib64, and in PIL it is written to search only in / usr / local / lib
Here is a diff that solves this problem:
And finally, an example installation for CentOS:
It is understood that the required version of python and python-devel are already installed in the required
virtual environment.
Now patch setup.py and continue in the required virtual environment:
virtualenv comes to the rescue ...
But after that you have to install additional modules for each python with your hands through pip
And here there are nuances. For example, with the PIL library,
it is perfectly installed, but when trying to work with it, it produces such excellent error messages.
decoder jpeg not available
The problem is that when building PIL, the library cannot work with jpeg, zlib, tiff, freetype, because in our case they are in / usr / lib64, and in PIL it is written to search only in / usr / local / lib
Here is a diff that solves this problem:
*** setup.py.orig 2012-12-01 16:11:49.000000000 +0400
--- setup.py 2012-12-01 16:12:15.000000000 +0400
***************
*** 147,152 ****
--- 147,154 ----
add_directory(library_dirs, "/opt/local/lib")
add_directory(include_dirs, "/opt/local/include")
+
+ add_directory(library_dirs, "/usr/lib64")
+ add_directory(library_dirs, "/usr/lib")
add_directory(library_dirs, "/usr/local/lib")
# FIXME: check /opt/stuff directories here?
And finally, an example installation for CentOS:
It is understood that the required version of python and python-devel are already installed in the required
virtual environment.
yum install libjpeg libjpeg-devel zlib zlib-devel libtiff libtiff-devel freetype freetype-devel
wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
tar -zxvf Imaging-1.1.7.tar.gz
cd Imaging-1.1.7
Now patch setup.py and continue in the required virtual environment:
python setup.py build --force
python setup.py install