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

已安装Pillow却提示AttributeError: module PIL has no attribute Image的问题求助

已安装Pillow却提示AttributeError: module PIL has no attribute Image的问题求助

我刚接触Python,用pip安装了Pillow包,但是在代码里导入后运行时却弹出了AttributeError: module PIL has no attribute Image的错误。

我的代码如下:

import PIL

with PIL.Image.open("before1.jpg") as Im:
    Im.show()

我已经重新安装过Python和Pillow,但问题还是没解决;甚至尝试换成Pillow 8.0.0版本,依然没用。之前我用pytest的时候也遇到过类似的问题。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.04.21 14:24:35