您的位置:首页 > 编程语言 > Python开发

python2.7下安装PIL库

2015-07-27 10:59 531 查看
window7下安装

1、因为PIL需要C++支持,先安装MicrosoftVisualC++9.0,安装下载地址:http://www.microsoft.com/en-us/download/details.aspx?id=44266

2、pipinstall
PIL--allow-externalPIL--allow-unverifiedPIL

或者直接下载exe版本:http://effbot.org/media/downloads/PIL-1.1.7.win32-py2.7.exe
http://www.pythonware.com/products/pil/
ubuntu下安装

1、先安装gcc编译

sudoapt-getinstallpython-dev

2、安装依赖包

sudoapt-getinstalllibjpeg8-devzlib1g-devlibfreetype6-dev

3、创建链接,因为PIP安装软件包时,并没有安装在系统路径里,因此做一个软连接。

对于64位系统:

对于32位系统:



4、安装,允许外部源
因為PIL引用了外部的源.所以sudopipinstallpil安装失败

sudopipinstallPIL--allow-externalPIL--allow-unverifiedPIL


如果报错
_imagingft.c:73:31:fatalerror:freetype/fterrors.h:Nosuchfileordirectory

cd/usr/include
sudoln-sfreetype2freetype


重新执行pipinstall
note:因为PIL库已经不维护了,建议安装pillow,只要pipinstallpillow即可
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: