max os 安装python模块PIL

时间:2023-01-07 19:00:44

下载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-
./configure --enable-shared --enable-static
make
sudo make install

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

安装zlib:

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

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

下载Imaging-1.1.7.tar.gz

安装imaging:

tar zxvf Imaging-1.1..tar.gz
cd Imaging-1.1.

修改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  

安装完毕。