安装PIL的坑
今天在centos中使用pip安装PIL死活不成功,报错:
Could not find a version that satisfies the requirement PIL (from versions: )
Some externally hosted files were ignored as access to them may be unreliable (use --allow-external PIL to allow).
No matching distribution found for PIL
但是使用pip search PIL查找,源中确实有该包:
PIL - Python Imaging Library
google之,得到如下办法(http://stackoverflow.com/questions/21242107/pip-install-pil-dont-install-into-virtualenv):
sudo pip install PIL --allow-external PIL --allow-unverified PIL
果然成功了。
但是程序运行时又报错:
font = ImageFont.truetype(os.path.join("fonts",font_type), font_size)
ImportError: The _imagingft C module is not installed
似乎是没有安装truetype扩展之类的。那就安装吧(http://stackoverflow.com/questions/4011705/python-the-imagingft-c-module-is-not-installed):
sudo yum install freetype-devel
然后卸载、重新安装PIL
sudo pip uninstall PIL
sudo pip install PIL --allow-external PIL --allow-unverified PIL
终于搞定了
PS:之前还尝试过从官网下载PIL源码自己编译安装:
(参照:http://www.cnblogs.com/free--coder/archive/2012/09/12/2681361.html)
1.下载源码并解压:
wget http://effbot.org/downloads/Imaging-1.1.7.tar.gz
tar -xzvf Imaging-1.1.7.tar.gz
2.编译安装(注意要root权限):
python setup.py build
python setup.py install
安装倒是成功了,但是python脚本运行时报错:
/usr/lib64/python2.7/site-packages/PIL/Image.py:81: RuntimeWarning: The _imaging extension was built for another version of Pillow or PIL
warnings.warn(str(v), RuntimeWarning)
Traceback (most recent call last):
File "captcha.py", line 3, in <module>
import Image, ImageDraw, ImageFont, ImageFilter
File "/usr/lib64/python2.7/site-packages/PIL/Image.py", line 65, in <module>
raise ImportError("The _imaging extension was built for another "
ImportError: The _imaging extension was built for another version of Pillow or PIL
似乎版本不对。。。。。
放弃了
安装PIL的坑的更多相关文章
- Mac osx 安装PIL出现Some externally hosted files were ignored (use --allow-external PIL to allow).
出现这个问题Some externally hosted files were ignored (use --allow-external PIL to allow)的主要原因是PIL的一些依赖库还没 ...
- Mac下安装 PIL
最近入手MacBook Pro 在配置PIL环境的时候遇到一些问题.现在把解决方式记录下来,希望对有需要的有所帮助. 1. 安装brew : brew 又叫Homebrew,是Mac OSX上的软件 ...
- 安装PIL库时提示python未注册错误(自定义python安装路径)
import sys from _winreg import * # tweak as necessary version = sys.version[:3] installpath = sys.pr ...
- 64位Python安装PIL
写个小程序需要安装PIL,但是官网只有32位,无法找到64位安装路径.根据网上教程自行编译,但是由于VS版本问题总是提示“Python error: Unable to find vcvarsall. ...
- Mac系统下安装PIL
安装PIL依赖JPEG.Freetype.LittleCMS, 首先安装这三个环境(第一至三步): 第一步:安装JPEG http://www.ijg.org/files/jpegsrc.v8c.ta ...
- ubuntu Python2.7 安装PIL问题
$sudo easy_install PIL WARNING: '' not a valid package name; please use only.-separated package name ...
- 安装PIL遇到的问题
配置:Win7 64位 不过折腾到最后,没有使用PIL,官方的PIL很久木有更新了,换了Pillow,是PIL的衍生吧,一直有更新,但是两者不可在同一环境共存. 1 Python version 2. ...
- 关于python下安装PIL库遇到的问题及解决办法
关于python下安装PIL库遇到的问题及解决办法 关于python下安装PIL库遇到的问题及解决办法 :在下面这个网址下载pipllow(a replacement for PIL) www.lfd ...
- [转]安装PIL时注册表中找不到python2.7
如果在win7x64安装python2.7的时候选择了all user,则安装PIL的时候会显示找不到python. 解决办法:复制下面的代码到一个.py文件并运行: # # script to re ...
随机推荐
- gitlab和github的区别
先说一下相同点,二者都是基于web的Git仓库,在很大程度上GitLab是仿照GitHub来做的,它们都提供了分享开源项目的平台,为开发团队提供了存储.分享.发布和合作开发项目的中心化云存 ...
- electron-builder中NSIS相关配置
electron-builder中NSIS相关配置 相比较于electron-packager打包,使用electron-builder打包使得包体积更小.在electron-builder中,对于N ...
- 六十六 aiohttp
asyncio可以实现单线程并发IO操作.如果仅用在客户端,发挥的威力不大.如果把asyncio用在服务器端,例如Web服务器,由于HTTP连接就是IO操作,因此可以用单线程+coroutine实现多 ...
- BotFramework Nodejs示例
关于Bot Framework知识,可以参考<Nodejs Bot学习> 本文是根据bot framework sample<https://github.com/Microsoft ...
- HDU3466 Proud Merchants [背包]
题目传送门 Proud Merchants Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/O ...
- 洛谷P3539 [POI2012] ROZ-Fibonacci Representation
题目传送门 转载自:five20,转载请注明出处 本来看到这题,蒟蒻是真心没有把握的,还是five20大佬巨orz 首先由于斐波拉契数的前两项是1,1 ,所以易得对于任何整数必能写成多个斐波拉契数加减 ...
- 2. 创建一个简单的Maven项目
☞ 创建项目 选定一个目录,如E:\workspace\maven,新建的项目将放在这个目录. 运行CMD,切换到该目录. 执行mvn archetype:generate直到输出"Choo ...
- Pandas分组运算(groupby)修炼
Pandas分组运算(groupby)修炼 Pandas的groupby()功能很强大,用好了可以方便的解决很多问题,在数据处理以及日常工作中经常能施展拳脚. 今天,我们一起来领略下groupby() ...
- eclipse 设置英文
只需要将eclipse解压目录下的eclipse.ini文件中加入下面一句话就可以了(注意这句话应该单独存在一行): -Duser.language=EN 如下图: 配置完成后,重启eclipse ...
- 1. ECMAScript 6 简介--ES6
1. ECMAScript 和 JavaScript 的关系 国际标准化组织ECMA 制定了语言 ECMAScript, 该标准针对 Javascript 语言制定, 不叫Javascript 原因有 ...