Python安装Imaging报错:The _imaging C module is not installed问题解决方法

yipeiwu_com5年前Python基础

今天写Python程序上传图片需要用到PIL库,于是到http://www.pythonware.com/products/pil/#pil117下载了一个1.1.7版本的,我用的是CentOS64 并且自行升级后的Python版本安装PIL库
首先下载解压:

复制代码 代码如下:

[root@lee ~]# wget http://www.pythonware.com/products/pil/#pil117
[root@lee ~]# tar -xf Imaging-1.1.7.tar.gz

然后准备安装
复制代码 代码如下:

[root@lee ~]# cd Imaging-1.1.7
[root@lee Imaging-1.1.7]# python python setup.py build_ext -i

都没问题,当测试安装的时候却老提示:*** The _imaging C module is not installed
复制代码 代码如下:

[root@lee Imaging-1.1.7]# python selftest.py
*** The _imaging C module is not installed

找了半天,也找不出是什么原因,后来终于在官网从一堆英文中找到了关键所在,解决方法,实际根据自己的python PIL路径设置
复制代码 代码如下:

[root@lee Imaging-1.1.7]# echo '/usr/local/lib/python2.7/site-packages/PIL' >> /etc/ld.so.conf
[root@lee Imaging-1.1.7]# ldconfig

重新python selftest.py,一路安装完成

相关文章

Python部署web开发程序的几种方法

1、fastcgi ,通过flup模块来支持,在nginx里对应的配置指令是 fastcgi_pass 2、http,nginx使用proxy_pass转发,这个要求后端appplica...

python读取xlsx的方法

如下所示: import xlrd data = xlrd.open_workbook('path') # 第1个sheet table = data.sheet()[0]...

py中的目录与文件判别代码

>>> import os          &...

基于scrapy实现的简单蜘蛛采集程序

本文实例讲述了基于scrapy实现的简单蜘蛛采集程序。分享给大家供大家参考。具体如下: # Standard Python library imports # 3rd party i...

使用matplotlib中scatter方法画散点图

使用matplotlib中scatter方法画散点图

本文实例为大家分享了用matplotlib中scatter方法画散点图的具体代码,供大家参考,具体内容如下 1、最简单的绘制方式 绘制散点图是数据分析过程中的常见需求。python中最有...