安装PIL

安装PIL

仅针对jepg,其他格式支持仿照即可。这是目前我查找和用过的最简单的方法,而且没有使用任何系统的安装。

编译jpeg库

$ wget http://www.ijg.org/files/jpegsrc.v8c.tar.gz
$ tar -xvzf jpegsrc.v8c.tar.gz
$ cd jpeg-8c/
$ ./configure --prefix=LOCAL_PATH
$ make 
$ make install

--prefix后面的LOCAL_PATH可以自己定义路径.执行完上面的命令会在你的prefix设定的目录下出现 bin include lib share这几个目录

编译 PIL

下载源代码

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

setup.pyJPEG_ROOT = ("LOCAL_PATH/lib", "LOCAL_PATH/include") 这样就制定了jpeg的编译路径

编译 PIL

python setup.py build_ext -i

编译完可以测试一下:

python selftest.py

会出现如下测试结果:

--------------------------------------------------------------------
PIL 1.1.7 TEST SUMMARY
--------------------------------------------------------------------
Python modules loaded from ./PIL
Binary modules loaded from ./PIL
--------------------------------------------------------------------
--- PIL CORE support ok
*** TKINTER support not installed
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
*** FREETYPE2 support not installed
*** LITTLECMS support not installed
--------------------------------------------------------------------
Running selftest:
--- 57 tests passed.

表明JPEG支持测试通过

安装 PIL python setup.py install

你可能感兴趣的:(python)