用pil产生验证码出现:ImportError: The _imagingft C module is not installed
这个是由于PIL没有编译freetype导致的
查看 lib/python2.7/site-packages/PIL/
看看 _imagingft.so 是否存在
# 需要先安装jpeg库
wget http://www.ijg.org/files/jpegsrc.v7.tar.gz
tar -zxvf jpegsrc.v7.tar.gz
cd jpeg-7
CC="gcc -arch x86_64"
./configure --enable-shared --enable-static
make
make install
# 然后再安装PIL库
让PIL支持freetype的方法
1、安装freetype开发库
yum install freetype-devel
2、下载源代码http://effbot.org/downloads/Imaging-1.1.7.tar.gz
3、修改setup.py文件
修改
JPEG_ROOT = libinclude("/usr/local")
FREETYPE_ROOT = '/usr/lib64','/usr/include/freetype2/freetype'
4、查看支持项
python setup.py build_ext -i
--- FREETYPE2 support available 注意这一项
5、编译安装
python setup.py install
若上面的设置都失败,则只能拿出下面的杀手锏:
sudo apt-get build-dep python-imaging
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libjpeg.so /usr/lib/
sudo ln -s /usr/lib/`uname -i`-linux-gnu/libz.so /usr/lib/
pip install -U PIL 当现下面的提示时,则说明安装成功了:
--------------------------------------------------------------------
PIL 1.1. SETUP SUMMARY
--------------------------------------------------------------------
version 1.1.
platform linux2 2.7. (default, Apr , ::)
[GCC 4.6.]
--------------------------------------------------------------------
--- TKINTER support available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available
--------------------------------------------------------------------
用pil产生验证码出现:ImportError: The _imagingft C module is not installed的更多相关文章
- Python 的PIL,可以解决ImportError The _imagingft C module is not installed
删除PIL相关文件 mv PIL /tmp pip install Pillow 安装Pillow后, 可能还会发生KeyError的错误, 检查项目源码后发现是 Image 模块的save函数中 ...
- ImportError: The _imagingft C module is not installed
添加验证码模块的时候,发布到服务器上居然报了这个错误 ImportError: The _imagingft C module is not installed 然而pillow是已经装在服务器上的, ...
- Python图片处理PIL/pillow/生成验证码/出现KeyError: 和The _imagingft C module is not installed
最近在用Python开发自己的博客,需要用到Python生成验证码,当然肯定要用到Python的图形处理库PIL,因为我用的是windows. 所以在安装好pil之后就开始写,就按照题目所说出现了Th ...
- Python: The _imagingft C module is not installed错误的解决
Python: The _imagingft C module is not installed错误的解决 By 白熊花田(http://blog.csdn.net/whiterbear) 转载需注明 ...
- pip install PIL The _imagingft C module is not installed
需要先删除PIL再进行安装 sudo pip uninstall -y PIL 删除PIL相关文件夹:/usr/local/bin/pil , usr/lib/python2.7/dist-packa ...
- PIL The _imaging C module is not installed
今天在WIN 7 64位用PIL的时候,提示 The _imaging C module is not installed ,原来是需要安装64位的. 刚开始安装的是这个:http://www.pyt ...
- 在eclipse中用java调用python报错 Exception in thread "main" ImportError: Cannot import site module and its dependencies
最近做项目需要用java调用python,配置了jython后,运行了例子代码: 获得一个元组里面的元素: import org.python.util.PythonInterpreter; publ ...
- 利用PIL创建验证码
1. 随机生成rgb 元组 def random_RGB(min, max): return tuple([random.randint(min, max) for i in range(3)])2. ...
- PIL、Pillow安装使用方法
PIL(Python Imaging Library)是Python常用的图像处理库,而Pillow是PIL的一个友好Fork,提供了了广泛的文件格式支持,强大的图像处理能力,主要包括图像储存.图像显 ...
随机推荐
- lua实现单例模式
Singleton = {} function Singleton:new(o) o = o or {} setmetatable(o,self) self.__index = self return ...
- Entity Framework 复杂类型(转)
为了说明什么是复杂属性,先举一个例子. public class CompanyAddress { public int ID { get; set; } public string CompanyN ...
- Java Int和Integer有什么区别?
Int int是我们常说的整型数字,是Java的8个原始数据类型(Primitive Type:boolean.byte.short.char.int.float.double.long)之一.Jav ...
- jquery 添加列
{field:'action',title:'操作',width:70,align:'center', formatter:function(value,row,index){ if (row.e ...
- JS的 instanceof 方法
http://www.cnblogs.com/jasonxuli/p/6769282.html 这是 2014-12-10 发在 iteye 上的文章 今天突然想起js的原型继承模型和相关的proto ...
- 端口安全检查shell脚本
#!/bin/bash #This script name is scan_analyse.sh . /etc/profile echo "start time is $(date)&quo ...
- NOIP2016 “西湖边超萌小松鼠” 模拟赛
总的来说,这套题的难度比较接近近些年来Day1的真实难度,认为非常值得一打 GotoAndPlay 题目大意 询问这个图上是否存在一种跳法,能跳到这个图上的每一个点 题目解析 犯了个低级错误,双向边忘 ...
- 学习maven,看思维导图就够了
一直在用 Mindjet MindManager和xmind 做思维导图.以前在用思维导图写读书笔记时,总是想要事无巨细地写清楚每个知识点,现在想来是事倍功半.思维导图应该是一个帮助我们梳理知识点.理 ...
- centos7 Java开发环境构建
原帖 https://www.cnblogs.com/youcong/p/9118753.html Java开发基本环境 1.jdk的安装 https://www.cnblogs.com/zenghu ...
- 使用 while 循环
与 for 循环不同,while 循环会一直运行,直到给定条件不满足为止.例如,下面的 while 循环从 x=0 开始.每次循环都会检查 x<=10 是否成立.如果成立,就执行循环内部的表达式 ...