安装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 ...
随机推荐
- Java学习笔记(十一)——通过JDBC操作mysql数据库
[前面的话] 时间总是好快,每次都感觉还没有怎么好好去过,对于好多事情,希望自己可以做的更多一点.心情能够好一点,平淡一点就行了. 学习过程中的知识点总结,基础知识,选择阅读. [JDBC定义] 定义 ...
- [BZOJ5305][Haoi2018]苹果树 组合数
题目描述 小 C 在自己家的花园里种了一棵苹果树, 树上每个结点都有恰好两个分支. 经过细心的观察, 小 C 发现每一天这棵树都会生长出一个新的结点. 第一天的时候, 果树会长出一个根结点, 以后每一 ...
- hdu5728
详细题解: http://blog.csdn.net/wust_zzwh/article/details/51966450 ……化简公式的能力还不够啊…… #include<bits/stdc+ ...
- jQuery源码浅析
这几天看了下jQuery源码,有些收获,解答了我以前对jQuery的疑问,现在我把收获分享给大家. 一.jQuery为何弄成自执行函数,以及为何在引用了jquery文件之后,可以通过$或jQuery来 ...
- div随意拖动,基于jquery。
$("#box").mousedown(function (e) { //e鼠标事件 var offset = $(this).position();//DIV在页面的位置 使用p ...
- 转:libFuzzer Tutorial(libFuzzer教程)
转:https://github.com/google/fuzzer-test-suite/blob/master/tutorial/libFuzzerTutorial.md 本文在Ubuntu16下 ...
- Nginx开启跨域访问
CORS on Nginx The following Nginx configuration enables CORS, with support for preflight requests. # ...
- 【BZOJ 1815】【SHOI 2006】color 有色图
http://www.lydsy.com/JudgeOnline/problem.php?id=1815 这道题好难啊,组合数学什么根本不会啊qwq 题解详见08年的Pólya计数论文. 主要思想是只 ...
- bzoj 1734: [Usaco2005 feb]Aggressive cows 愤怒的牛
1734: [Usaco2005 feb]Aggressive cows 愤怒的牛 Description Farmer John has built a new long barn, with N ...
- 初识Tomcat系统架构
俗话说,站在巨人的肩膀上看世界,一般学习的时候也是先总览一下整体,然后逐个部分个个击破,最后形成思路,了解具体细节,Tomcat的结构很复杂,但是 Tomcat 非常的模块化,找到了 Tomcat最核 ...