首页 > 解决方案 > cv2 python 没有 imread 成员

问题描述

我点安装了 OpenCV-python。安装似乎很好,我在 python IDLE 上对其进行了测试。它运行没有任何问题。我一直在尝试在 VS Code 上运行它,但它似乎不起作用。自动完成功能可以识别 imread 函数,但是当我输入它时会抛出一个错误,指出 cv2 没有 imread 成员。我正在使用最新版本的python

我这样称呼它:img2 = cv2.imread("C:\Biometric\min.jpg", 0)

标签: python-3.xopencv

解决方案


由于您尝试使用 VS Code 执行此操作,请尝试以下步骤

(1) open palette on VS Code (use specifies command): CTRL + Shift + P
(2) then select "Preferences: Open Settings (JSON)" option in the palette dropdown
(3) then add the following line in the opened "settings.json" file
"python.linting.pylintArgs": ["--generate-members"]

这必须有效


推荐阅读