centos linux pil 安装,centos 安装python PIL模块

1、安装

使用yum安装缺少类库:

#尤其重要,否则会报错

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

b7fc7ec0e4687f382ba3288d1a445b5a.png

#修改配置文件setup.py

TCL_ROOT = "/usr/lib/"JPEG_ROOT= "/usr/lib/"ZLIB_ROOT= "/usr/lib/"TIFF_ROOT= "/usr/lib/"FREETYPE_ROOT= "/usr/lib/"LCMS_ROOT= "/usr/lib/"

#安装

python setup.py install

b7fc7ec0e4687f382ba3288d1a445b5a.png

问题:

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

了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值