【发布时间】:2021-05-14 04:46:59
【问题描述】:
我正在使用 Jupyter 笔记本,但出现此错误
AttributeError: 模块 'cv2' 没有属性 'imread'
成功运行命令后
import cv2
import matplotlib.pyplot as plt
dir(cv2)
输出为
['doc',
'file',
'loader',
'name',
'package',
'path',
'spec']
如何在 Jupyter notebook 中读取图像?
【问题讨论】:
-
你能发布完整的错误堆栈吗?
-
我猜你已经创建了自己的文件
cv2.py。这将首先加载。 -
@sociopath 这里是完整的错误堆栈 AttributeError Traceback(最近一次调用最后一次)
in 2 import matplotlib.pyplot as plt 3 img1path=r"C: \Users\DELL\Downloads\Image034" ----> 4 img1 = cv2.imread(img1path) 5 plt.imshow(img1) AttributeError: module 'cv2' has no attribute 'imread' -
@TimRoberts 我没有创建任何这样的文件
-
请
import cv2/print(cv2.__file__)/print(cv2.__version__)。