当我尝试运行使用PIL的python程序时出现以下错误。
Generate_Dot.py:14: RuntimeWarning: the frombuffer defaults may change in a future release; for portability, change the call to read:
frombuffer(mode, size, data, 'raw', mode, 0, 1)
img = Image.frombuffer('L', size, data)
Traceback (most recent call last):
File "Generate_Dot.py", line 15, in <module>
img.save('image.png')
File "/home/kapil/python/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/PIL/Image.py", line 1439, in save
save_handler(self, fp, filename)
File "/home/kapil/python/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/PIL/PngImagePlugin.py", line 572, in _save
ImageFile._save(im, _idat(fp, chunk), [("zip", (0,0)+im.size, 0, rawmode)])
File "/home/kapil/python/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/PIL/ImageFile.py", line 481, in _save
e = Image._getencoder(im.mode, e, a, im.encoderconfig)
File "/home/kapil/python/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-i686.egg/PIL/Image.py", line 401, in _getencoder
raise IOError("encoder %s not available" % encoder_name)
IOError: encoder zip not available
答案 0 :(得分:0)
cpython依赖于系统中安装的各种第三方库。在这种情况下,需要'zip'来执行一些压缩。我猜测在这种情况下它将是gzip,compress或zlib之一。您应该可以使用yum或apt-get轻松安装这些。