Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/305.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python IOError:编码器zip不可用ubuntu_Python_Python 2.7_Python Imaging Library_Zlib_Pillow - Fatal编程技术网

Python IOError:编码器zip不可用ubuntu

Python IOError:编码器zip不可用ubuntu,python,python-2.7,python-imaging-library,zlib,pillow,Python,Python 2.7,Python Imaging Library,Zlib,Pillow,当我试图运行使用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,

当我试图运行使用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

cpython依赖于系统中安装的各种第三方库。在这种情况下,需要“zip”来执行一些压缩。我猜在这种情况下,它将是gzip、compress或zlib中的一种。您应该能够使用yum或apt-get非常轻松地安装这些工具。

副本中答案的可能副本不适合他,因为他没有root访问权限。我已经阅读了上述链接并尝试过,但没有成功:-我没有根权限通过apt get下载和安装它。我从源代码在我的主目录中安装了zlib,但我一直在想如何将它链接到主目录中安装的python。使用libz.so将目录添加到您的LD_LIBRARY_PATH环境变量。导出LD\u LIBRARY\u PATH=~/mylibs/:$LD\u LIBRARY\u路径尝试添加到PYTHONPATH。