我有一個django應用程序,需要PIL,我一直在得到錯誤,所以我決定在我的託管服務器上玩PIL。virtualenv奇怪的PIL行爲 - Python
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
>>>
我能夠在我的virtuaelnv中成功導入zlib – AlexBrand