Ubuntu安装PIL(Python Image Library)

安装default package

sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev  

建立软连接

sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib  
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib  
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib

通过pip安装

sudo pip install PIL

却出现了如下错误:

Could not find a version that satisfies the requirement PIL (from versions: )No matching distribution found for PIL

搜索后发现,PIL换了名字,变成了Pillow

于是果断安装

sudo pip install Pillow

在命令行中查看版本

>>> import PIL
>>> PIL.VERSION
'1.1.7'

即说明安装成功

参考博客

Install python PIL( Python image Library ) on Ubuntu 11.10 Oneiric
python 安装PIL

你可能感兴趣的:(Ubuntu安装PIL(Python Image Library))