ubuntu Python2.7 安装PIL问题

时间:2014-07-06 13:45:43   收藏:0   阅读:256
$sudo easy_install PIL
WARNING: ‘‘ not a valid package name; please use only.-separated package names in setup.py
_imaging.c:75:20: fatal error: Python.h: 没有那个文件或目录
 #include "Python.h"
                    ^
compilation terminated.
error: Setup script exited with error: command x86_64-linux-gnu-gcc failed with exit status 1

通过easy_install 安装PIL提示以上错误,解决方法:

$ sudo apt-get install python-dev

再次安装PIL成功。

测试:将一个图片生成缩略图:

#!/usr/bin/env python

from PIL import Image

im = Image.open(test.jpg)

print im.format, im.size, im.mode


im.thumbnail((120,120))


im.save(thumb.jpg, JPEG)

 

 

ubuntu Python2.7 安装PIL问题,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!