PIL折腾2个小时,WTF!

新弄了台服务器,尝鲜下Ubuntu 14.04,一切顺利,各种环境轻松配置搞定之后,安装python的一个包竟然出问题了,对就是这古老的PIL浪费2个大小时,最后迫于无奈使用pillow替代了。

安装依赖:

$ sudo apt-get install python-dev libjpeg-dev libfreetype6-dev zlib1g-dev

创建链接:

$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
$ sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/

安装piplow(多次pil无果的情况下决定的):

pip install pillow

返回结果

 --------------------------------------------------------------------
 PIL SETUP SUMMARY
 --------------------------------------------------------------------
 version Pillow 2.7.0
 platform linux2 2.7.6 (default, Mar 22 2014, 22:59:56)
 [GCC 4.8.2]
 --------------------------------------------------------------------
 *** TKINTER support not available
 --- JPEG support available
 *** OPENJPEG (JPEG2000) support not available
 --- ZLIB (PNG/ZIP) support available
 *** LIBTIFF support not available
 --- FREETYPE2 support available
 *** LITTLECMS2 support not available
 *** WEBP support not available
 *** WEBPMUX support not available
 --------------------------------------------------------------------

否则可能遇到乱七八糟的错误,比如:

error: Setup script exited with error: command 'gcc' failed with exit status 1`
error: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
error: command 'clang' failed with exit status 1
error: command 'gcc' failed with exit status 1