gpt4 book ai didi

python - PIL 无法识别 Mac OS 下的 jpeg 库

转载 作者:太空狗 更新时间:2023-10-30 00:51:30 25 4
gpt4 key购买 nike

这样的脚本:

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 安装 jpeg导致 错误:jpeg-8d 已经安装
  • brew install libjpeg 导致 Error: jpeg-8d already installed
  • sudo pip install Pillow - 安装有效但没有任何改变

如何为我的 PIL 安装获得 jpeg 支持?有什么想法吗?

最佳答案

我不明白为什么,但重新安装 PIL 解决了这个问题:

sudo pip uninstall pil
sudo pip install pil

关于python - PIL 无法识别 Mac OS 下的 jpeg 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11820649/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com