像这样的脚本:
from PIL import Image, ImageOps
img = Image.open('1.JPG')
thumb = ImageOps.fit(img, (200,200) , Image.ANTIALIAS, (0.5, 0.5))
导致此IOError的原因:
Traceback (most recent call last):
(...)
File "/Library/Python/2.7/site-packages/PIL/Image.py", line 385, in _getdecoder
raise IOError("decoder %s not available" % decoder_name)
IOError: decoder jpeg not available
我如何获取PIL的jpeg支持?这个问题似乎很常见,但现有的线程对我没有解决办法。我使用brew和pip来安装我的Python软件包,并已经尝试了以下方法:
brew install jpeg
导致错误:jpeg-8d已经安装
brew install libjpeg
导致错误:jpeg-8d已经安装
sudo pip install Pillow
- 安装成功但未改变任何内容