PIL(Python Imaging Library)是Python常用的图像处理库,而Pillow是PIL的一个友好Fork,提供了了广泛的文件格式支持,强大的图像处理能力,主要包括图像储存、图像显示、格式转换以及基本的图像处理操作等。
Pillow的文档:http://pillow.readthedocs.io/en/latest/
Pillow的github:https://github.com/python-pillow/Pillow
0x1. windows安装PIL
PIL安装很麻烦,推荐下载exe直接安装
PIL官网:http://pythonware.com/products/pil/
但现在里面下载链接访问不了,我把32位和64位版本上传到博客资源以供下载。
PILwin32:http://download.youkuaiyun.com/download/th_num/10140028
PILwin64:http://download.youkuaiyun.com/download/th_num/10140029
0x2. windows安装Pillow
pip install Pillow
或者在http://www.lfd.uci.edu/~gohlke/pythonlibs/#pillow 下载wheel文件使用pip安装
0x3. linux安装Pillow
在linux里安装PIL不怎么建议,依赖也多,而且会有各种报错。
kali的python默认已安装了Pillow。
在debian/ubuntu里安装Pillow:
sudo apt-get install python-imaging
或者
sudo pip install -I --no-cache-dir -v Pillow
python-imaging安装后的支持import Image
Pillow报KeyError问题
如果Image.SAVE.keys()输出为空,则说明没有找到save format key,在生成图片时就会报KeyError, 此时就需要把import Image改成from PIL import Image
本文介绍了Pillow作为PIL的友好分支,在Windows和Linux环境下如何进行安装,并提供了解决常见错误的方法。针对Windows用户提供了预编译的安装包下载链接。
1万+

被折叠的 条评论
为什么被折叠?



