首页 > 解决方案 > 模块 'PIL.Image' 没有属性 'load'

问题描述

image = Image.load(img)

这条线给了我错误。我试图加载图像。
AttributeError: module 'PIL.Image' has no attribute 'load'

标签: pythonpython-imaging-library

解决方案


改为这样做:

from PIL import Image
image = Image.open("path_to_image.png")

将“path_to_image”替换为您的实际路径。

请阅读文档:https ://pillow.readthedocs.io/en/stable/handbook/tutorial.html


推荐阅读