用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,提供了了广泛的文件格式支持,强大的图像处理能力,主要包括图像储存.图像显 ...
随机推荐
- No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
一.什么是跨域访问 举个栗子:在A网站中,我们希望使用Ajax来获得B网站中的特定内容.如果A网站与B网站不在同一个域中,那么就出现了跨域访问问题.你可以理解为两个域名之间不能跨过域名来发送请求或者请 ...
- 排序问题Java
package zhuzhuangtu; import java.util.*; import java.io.*; public class Main{ public static void mai ...
- centos远程访问mssql数据库
http://blog.path8.net/archives/5921.html http://www.jaggerwang.net/2013/03/18/centos%E4%B8%8B%E5%AE% ...
- MySQL基础语句【学习笔记】
放在这里,以备后查. 1. 数据库, 数据库服务器, 数据库语言 数据库,是持久性数据的集合,供给定企业的应用程序系统使用,并且由一个数据库管理系统来管理: 数据库服务器,又称数据库管理系统,用来管理 ...
- 常用DOS命令总结
本文主要参考:http://www.jb51.net/article/12360.htm http://blog.csdn.net/kofterry/article/details/5183110 常 ...
- Bootstrap风格zTree树形菜单插件
这是一款bootstrap风格jQuery zTree树形菜单插件,支持自定义编辑.添加列表菜单.删除列表等功能的jQuery树形菜单代码.在线演示 具体代码实现: <!DOCTYPE html ...
- Spring-Boot 中 Redis 的简单使用以及简单模糊匹配删除
https://yulaiz.com/spring-boot-redis-simple/
- Ubuntu 14.04 下安装 TFTP 艰辛之路【转】
本文转载自:https://blog.csdn.net/donglicaiju76152/article/details/76651210 背景 按说在Linux下安装tftp server 很简单, ...
- Exception.StackTrace
Exception中的StackTrace属性 执行堆栈跟踪在给定时刻正在执行的所有方法. 对方法调用的跟踪称为堆栈跟踪. 堆栈跟踪列表提供了一种循着调用堆叠跟踪到方法中异常发生处行号的手段.Stac ...
- Ubuntu 安装 Telnet
参考:在 ubuntu 上安裝 telnet service 1.安装: sudo apt-get install xinetd telnetd 2.修改inetd.conf: vim /etc/in ...