python - 模块 'PIL.Image' 没有属性 'load'
问题描述
image = Image.load(img)
这条线给了我错误。我试图加载图像。
AttributeError: module 'PIL.Image' has no attribute 'load'
解决方案
改为这样做:
from PIL import Image
image = Image.open("path_to_image.png")
将“path_to_image”替换为您的实际路径。
请阅读文档:https ://pillow.readthedocs.io/en/stable/handbook/tutorial.html
推荐阅读
- android - 在 Android Studio 中将文件夹移到项目之外
- python-3.x - 陷入循环 <> 代码不想拉除第 1 行之外的任何内容
- .net - NET Core 无法建立 SSL 连接 - .HTTPClient
- c++ - C++ 类没有成员
- typescript - Vue.js 3:使用自定义类型验证道具类型
- sql - 如何划分获得的数据总和
- javascript - 如何在javascript中实现螺旋迭代?
- c++ - C ++如何实现可调整大小的堆栈数组?
- css - Chrome 文本元素重新调整
- rust - 使用Arrow/Datafusion/Polars(如python panda的groupby)按列值分区?