You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

CentOS 7中Pillow 2.9.0已安装libwebp但仍无法启用WebP支持的问题求助

CentOS 7中Pillow 2.9.0已安装libwebp但仍无法启用WebP支持的问题求助

我正在CentOS 7上尝试为Pillow 2.9.0启用WebP支持,但只能使用yum安装包(不能用pip)。以下是我目前做过的操作:

已执行的步骤

  • 用yum安装libwebp及其开发包:
yum install libwebp libwebp-devel
  • 确认已安装的libwebp版本:
# rpm -q libwebp
libwebp-0.3.0-11.el7.x86_64
  • 重新安装python-pillow,期望它能在编译时集成WebP支持:
yum reinstall python-pillow
  • 检查WebP支持是否生效:
python -c "from PIL import Image; print('WebP support:', 'WEBP' in Image.SAVE)"
('WebP support:', False)

额外说明

  • 这是个遗留系统,完全无法使用pip,只能依赖yum进行包管理
  • libwebp和libwebp-devel已经安装并更新到默认仓库的最新版本
  • 全程使用CentOS 7官方默认软件仓库

遇到的问题

尽管完成了上述步骤,WebP支持还是没启用。我是不是漏掉了什么关键操作?有没有其他方法能确保Pillow编译时带上WebP支持?

另外我尝试过从源码重新编译PIL来开启WebP支持,但编译后出了大问题——就连最基础的from PIL import Image导入都会报错:

from PIL import Image
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "PIL/Image.py", line 63, in <module>
    from PIL import _imaging as core
ImportError: cannot import name _imaging

想请教下,在python-pillow 2.9 + Python 2.7的环境下,有没有可行的方法启用WebP支持?会不会是我哪里操作失误了?

备注:内容来源于stack exchange,提问作者Paul

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.13 19:22:58