我是Python新手;我使用 pip 安装枕头包并尝试将其导入到我的代码中,但是当我运行代码时,它显示 AttributeError: module PIL has no attribute Image。 这是我的代码: 导入PIL
with PIL.Image.open("before1.jpg") as Im:
Im.show()
我重新安装了python和pillow,但没有任何变化; 我尝试使用枕头 8.0.0 但没有任何变化; 以前我对 pytest 有同样的问题
你需要像这样导入它
from PIL import Image
这样它就可以找到Image类