Linux 安装Python/PIL模块

1、安装PIL所需的系统库

$ yum install zlib zlib-devel
$ yum install libjpeg libjpeg-level
$ yum install freetype freetype-devel

2、删除Python下安装的PIL

rm -rf /usr/lib/python2.7/site-packages/PIL
rm /usr/lib/python2.7/site-packages/PIL.pth
#或者
rm -rf /usr/lib/python2.7/dist-packages/PIL
rm /usr/lib/python2.7/dist-packages/PIL.pth
#如果/usr/local/python2.7/dist-packages/PIL存在最好也全部删除

3、下载安装PIL

$ wget http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
$ tar -zxvf Imaging-1.1.7
$ cd Imaging-1.1.7
$ python setup.py build_ext -i  #用来进行安装前的检查
$ #修改setup.py
TCL_ROOT = "/usr/lib64/"
JPEG_ROOT = "/usr/lib64/"
ZLIB_ROOT = "/usr/lib64/"
TIFF_ROOT = "/usr/lib64/"
FREETYPE_ROOT = "/usr/lib64/"
LCMS_ROOT = "/usr/lib64/"
$ #安装
$ python setup.py install

你可能感兴趣的:(Linux,python,pil)