max os 安装python模块PIL

2014/01/28

下载libjpeg和zlib:

http://www.ijg.org/files/jpegsrc.v9.tar.gz

http://zlib.net/zlib-1.2.8.tar.gz

安装libjpeg

tar zxvf jpegsrc.v9.tar.gz   
cd jpeg-9  
./configure --enable-shared --enable-static  
make  
sudo make install  

默认安装在了:/usr/local/lib下。

安装zlib

tar zxvf zlib-1.2.8.tar.gz  
./configure  
make  
sudo make install

默认安装在了:/usr/local/lib下。

下载Imaging-1.1.7.tar.gz

安装imaging

tar zxvf Imaging-1.1.7.tar.gz
cd Imaging-1.1.7

修改imaging安装文件setup.py

JPEG_ROOT = "/usr/local/include"  
ZLIB_ROOT = "/usr/local/include"

编译imaging

python setup.py build_ext -i

测试

python selftest.py

如果提示:”57 tests passed.” 拿就可以安装

python setup.py install  

done.