ubuntu安装图像处理库PIL

PIL(Python Image Library)图像处理库,是python中最常用的图像处理库,目前的版本是1.17。该库提供了基本的图像处理功能,例如改变图像改变大小、格式转换、色场空间转换、图像增强、直方图处理、生成二维码、插值和滤波等。

在安装PIL之前,需要安装依赖库:zlib, png, freetype, jpeg

依赖运行库的安装:这个库是不能用 apt-get安装的,因此需要自己编译安装

安装依赖库:zlib
$:wget https://sourceforge.net/projects/libpng/files/zlib/1.2.8/zlib-1.2.8.tar.gz
$:tar -zxvf zlib-1.2.8.tar.gz
$:./configure --prefix=/usr/local/lib
$:cd zlib-1.2.8
$:make
$:sudo make install 

安装依赖库:png
$:wget ftp://ftp.simplesystems.org/pub/libpng/png/src/libpng16/libpng-1.6.21.tar.gz
$:tar -zxvf libpng-1.6.21.tar.gz
$:./configure --prefix=/usr/local/lib
$:cd libpng-1.6.21
$:make
$:sudo make install

安装依赖库:freetype
$:wget https://sourceforge.net/projects/freetype/files/freetype2/2.6.3/freetype-2.6.3.tar.gz
$:tar -zxvf freetype-2.6.3.tar-gz
$:./configure --prefix=/usr/local/lib
$:cd freetype-2.6.3
$:make
$:sudo make install

安装依赖库:jpeg
$:wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
$:tar -zxvf jpegsrc.v8c.tar.gz
$:cd jpeg-8c
$:./configure --prefix=/usr/local/lib
$:make
$:sudo make install

安装dev链接库

sudo apt-get install zlib1g-dev libpng12-dev libfreetype6-dev libjpeg8-dev

安装PIL库

$:wget wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
$:tar -zxvf Imaging-1.1.7
$:cd Imageing-1.1.7

修改setup.py
JPEG_ROOT = "/usr/local/lib"
ZLIB_ROOT = "/usr/local/lib"
FREETYPE_ROOT = "/usr/local/lib"

检查系统环境是否配置成功:
$:cd Imaging-1.1.7
$:python setup.py build_ext -i
running build_ext
--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.6 (default, Jun 22 2015, 17:58:13)
              [GCC 4.8.2]
--------------------------------------------------------------------
*** TKINTER support not available (Tcl/Tk 8.6 libraries needed)
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
只要JPEG、ZLIB、FREETYPE2 是 available就行

开始PIL的安装:
$:python setup.py build
(我出现的错误  不存在,处理方法:cd /usr/include  sudo ln -s freetype2 freetype)
$:python setup.py install

你可能感兴趣的:(配置安装,python)