欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

AttributeError: module ‘matplotlib‘ has no attribute ‘image‘

程序员文章站 2022-03-18 20:40:48
...

every blog every motto: We would rather reuse an active dwarf than a sleeping giant.

0. 前言

记录

1. 正文

报错

AttributeError: module 'matplotlib' has no attribute 'image'

代码如下

import matplotlib

print(matplotlib.__version__)
y_true = matplotlib.image.imread("./data/gt/labels_41r_51c.tif")  
print("y-true", y_true)

AttributeError: module ‘matplotlib‘ has no attribute ‘image‘
解决方法
代入时,导入如下即可

import matplotlib.image as img

完整代码

import matplotlib
import matplotlib.image as img

y_true = matplotlib.image.imread("./data/gt/labels_41r_51c.tif")

奇怪的解决方法……

相关标签: 问题