我有一个需要 PIL 的 django 应用程序,但我遇到了错误,所以我决定在我的托管服务器上使用 PIL。
PIL 安装在我的虚拟环境中。但是,在运行以下命令时出现错误,当我在虚拟环境之外运行它时,它可以工作。
Python 2.7.3 (default, Apr 16 2012, 15:47:14)
[GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Image
>>> im = Image.open('test.png')
>>> im
<PngImagePlugin.PngImageFile image mode=RGBA size=28x22 at 0x7F477CFFAE18>
>>> im.convert('RGB')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/python27/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/Image.py", line 679, in convert
self.load()
File "/opt/python27/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/ImageFile.py", line 189, in load
d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
File "/opt/python27/lib/python2.7/site-packages/PIL-1.1.7-py2.7-linux-x86_64.egg/Image.py", line 385, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder zip not available
>>>