centos 安装python PIL模块

前端之家收集整理的这篇文章主要介绍了centos 安装python PIL模块前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

centos 安装python PIL模块

1、安装

使用yum安装缺少类库:

@H_301_20@#尤其重要,否则会报错
yum install python-devel

yum install libjpeg libjpeg-devel zlib zlib-devel freetype freetype-devel lcms lcms-devel
yum install python-imaging

测试:

#解压
tar xvfz Imaging-1.1.7.tar.gz    
python setup.py build_ext -i

如果报缺少类库则手动安装:

下载资源:

http://www.pythonware.com/products/pil/index.htm下载最新版的PIL安装程序 tar xfz Imaging-1.1.7.tar.gz
http://www.ijg.org下载jpeg库jpegsrc.v8b.tar.gz
http://www.gzip.org/zlib/ 下载zlib-1.2.5.tar.gz支持压缩功能的zlib库

#我安装9a失败,安装的8b tar -zxf jpegsrc.v8b.tar.gz cd jpeg-8b ./configure && make && make test && make install
 tar xfz zlib-1.2.5.tar.gz
 cd zlib-1.2.5 ./configure && make && make install

修改配置后安装image

修改配置文件setup.py
TCL_ROOT = "/usr/lib/"    
JPEG_ROOT = "    
ZLIB_ROOT = "    
TIFF_ROOT = "    
FREETYPE_ROOT = "   
LCMS_ROOT = "

安装
python setup.py install

问题:

1、the imaging c module is not installed[5]

yum install python-imaging

参考:

[1] 64位CentOS下安装python的PIL模块.http://www.360doc.com/content/12/1103/21/8827884_245560257.shtml

[2] 64位centos下安装python的PIL模块.http://www.xuebuyuan.com/1397145.html

[3]python Image模块安装.http://blog.163.com/longsu2010@yeah/blog/static/173612348201193112324679/

[4]Linux 64位系统安装Python PIL模块.http://wangyou871228.blog.163.com/blog/static/27695152201361922011718/

[5] PIL will not import the _imaging C module: “*** The _imaging C module is not installed”.http://stackoverflow.com/questions/4113095/pil-will-not-import-the-imaging-c-module-the-imaging-c-module-is-not-ins



补充一点,一般都是用pillow来代替pil的,不过pillow的核心也是pil,

安装如下:

安装pillow出现以下问题:

ValueError: jpeg is required unless explicitly disabled using --disable-jpeg,aborting

----------------------------------------
Cleaning up...
Command /usr/local/bin/python -c"import setuptools,tokenize;__file__='/tmp/pip_build_root/pillow/setup.py';exec(compile(getattr(tokenize,'open',open)(__file__).read().replace('rn','n'),__file__,'exec'))"install --record /tmp/pip-SviNMc-record/install-record.txt --single-version-externally-managed --compile Failed with error code 1 in /tmp/pip_build_root/pillow
Storing debug log for failure in /root/.pip/pip.log

StackOverflow:http://stackoverflow.com/questions/34631806/fail-during-installation-of-pillow-python-module-in-linux

解决

sudo yum install python-devel
sudo yum install zlib-devel
sudo yum install libjpeg-turbo-devel

然后就可以:

pip install pillow

了。

原文链接:https://www.f2er.com/centos/380553.html

猜你在找的CentOS相关文章