安装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 ...
随机推荐
- Codeforces gym102058 J. Rising Sun-简单的计算几何+二分 (2018-2019 XIX Open Cup, Grand Prix of Korea (Division 2))
J. Rising Sun time limit per test 1.0 s memory limit per test 1024 MB input standard input output st ...
- 转:Google Project Zero挖洞经验整理
https://www.sec-un.org/google-project-zero%E6%8C%96%E6%B4%9E%E7%BB%8F%E9%AA%8C%E6%95%B4%E7%90%86/ 1. ...
- CodeForces 740D Alyona and a tree
倍增,延迟标记. 考虑一个$u$给他的哪几个祖先$v$贡献了$1$.越往上$dis(v,u)$越大,找到最远的一个还满足条件的$v$,$v$到$u$的父亲这条链上的答案都$+1$.延迟标记一下,然后从 ...
- 关于 Unity WebGL 的探索(一)
到今天为止,项目已经上线一个多月了,目前稳定运行,各种 bug 也是有的.至少得到了苹果的两次推荐和 TapTap 一次首页推荐,也算是结项后第一时间对我们项目的一个肯定. 出于各种各样的可描述和不可 ...
- 【java NIO】服务器端读写图片的一次排错经历
上传文件方面: 一.前端 使用的是jQuery框架来上传图片,参考的是harttle大神博客:http://harttle.com/2016/07/04/jquery-file-upload.html ...
- [LOJ2553]暴力写挂
锟题x2 以下用$a\rightarrow b$表示端点为$a,b$的链 把式子写成$(h_1(x)+h_1(y)-h_1(lca))-h_2(lca')$,第一部分就是$x\rightarrow r ...
- python基础之类与对象,继承与派生
类与对象 对象的本质也就是一个名称空间而已,用于存放自己独有的属性,而类中存放的是对象共有的属性. __init__会在调用类时自动触发 调用类时发生两件事: 1.创建一个空对象stu1 2.自动触发 ...
- ubuntu BCM43142 lenovo网卡驱动安装(Broadcom)
ubuntu13.10 lenovo网卡驱动安装(Broadcom) ubuntu当月刚出了13.10版本,在升级了操作系统版本后无法搜索无线热点,联想官网提供的驱动下载都是为windows准备的 ...
- python框架django中结合vue进行前后端分离
一:创建django项目 1.django-admin startproject mysite # 创建mysite项目 2.django-admin startapp app01# 创建app01应 ...
- 新浪微博宋琦:PHP在微博优化中的“大显身手”
摘要:2013中国软件开发者大会编程语言与工具专题论坛中,新浪微博架构师宋琦介绍了PHP在新浪微博中的应用,并且分享了很多微博主站所做的性能优化的工作. [CSDN报道] 2013中国软件开发者大会( ...