在CentOS 5.4 64位上安装了python2.6和PIL模块处理图片。
遇到问题1:
Traceback (most recent call last):
File “aimg.py”, line 3, in
img.save(‘/program/upload/b.jpg’,’JPEG’)
File “/usr/local/lib/python2.6/site-packages/PIL-1.1.7-py2.6-linux-
x86_64.egg/Image.py”, line 1406, in save
self.load()
File “/usr/local/lib/python2.6/site-packages/PIL-1.1.7-py2.6-linux-
x86_64.egg/ImageFile.py”, line 189, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File “/usr/local/lib/python2.6/site-packages/PIL-1.1.7-py2.6-linux-
x86_64.egg/Image.py”, line 385, in _getdecoder
raise IOError(“decoder %s not available” % decoder_name)
IOError: decoder jpeg not available
处理方法:
# rm -rf /usr/local/lib/python2.6/site-packages/PIL-1.1.7-py2.6-linux-x86_64.egg
# rm -rf /usr/local/lib/python2.6/site-packages/PIL.pth
# yum install -y libjpeg* freetype* zlib*
# easy_install PIL
遇到问题2:
WARNING: ” not a valid package name; please use only.-separated package names in setup.py
_imaging.c:75:20: error: Python.h: No such file or directory
In file included from libImaging/Imaging.h:14,
from _imaging.c:77:
libImaging/ImPlatform.h:14:2: error: #error Sorry, this library requires support for ANSI prototypes.
libImaging/ImPlatform.h:17:2: error: #error Sorry, this library requires ANSI header files.
libImaging/ImPlatform.h:55:2: error: #error Cannot find required 32-bit integer type
In file included from _imaging.c:77
处理方法:
yum install python-imaging
yum install python-dev
python PIL
再次测试问题解决。
发表评论