前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Python安装PIL图片处理库

Python安装PIL图片处理库

作者头像
用户2131907
发布2019-02-27 13:27:19
1.3K0
发布2019-02-27 13:27:19
举报

开发平台是Mac,需要用到Python的图像处理库PIL,下面记录了安装过程以及出现的问题。

基本安装过程是这样的,使用命令pip进行安装

代码语言:javascript
复制
$ pip install PIL
Downloading/unpacking PIL
  Could not find any downloads that satisfy the requirement PIL
  Some externally hosted files were ignored (use --allow-external PIL to allow).
Cleaning up...
No distributions at all found for PIL
Storing debug log for failure in /Users/mylxsw/.pip/pip.log

提示需要添加--allow-external参数

代码语言:javascript
复制
$ pip2.7 install PIL --allow-external PIL
Downloading/unpacking PIL
  Could not find any downloads that satisfy the requirement PIL
  Some insecure and unverifiable files were ignored (use --allow-unverified PIL to allow).
Cleaning up...
No distributions at all found for PIL
Storing debug log for failure in /Users/mylxsw/.pip/pip.log

又报错了,提示需要添加--allow-unverified参数

代码语言:javascript
复制
$ pip2.7 install PIL --allow-external PIL --allow-unverified PIL
...
_imagingft.c:73:10: fatal error: 'freetype/fterrors.h' file not found

#include <freetype/fterrors.h>

         ^

1 error generated.
...

提示缺少freetype/fterrors.h头文件,可是系统已经安装了,于是从stackoverflow上找到方案:

代码语言:javascript
复制
$ ln -s /usr/local/include/freetype2 /usr/local/include/freetype

再次安装

代码语言:javascript
复制
$ pip2.7 install PIL --allow-external PIL --allow-unverified PIL
Downloading/unpacking PIL
...
Successfully installed PIL
Cleaning up...

OK!

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-01-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档