python-3.x - cv2 python 没有 imread 成员
问题描述
我点安装了 OpenCV-python。安装似乎很好,我在 python IDLE 上对其进行了测试。它运行没有任何问题。我一直在尝试在 VS Code 上运行它,但它似乎不起作用。自动完成功能可以识别 imread 函数,但是当我输入它时会抛出一个错误,指出 cv2 没有 imread 成员。我正在使用最新版本的python
我这样称呼它:img2 = cv2.imread("C:\Biometric\min.jpg", 0)
解决方案
由于您尝试使用 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"]
这必须有效
推荐阅读
- gitlab - 避免合并请求的双重运行 - 除了 merge_requests 不起作用
- python - 是否可以在 python gRPC 服务器中返回自定义错误?
- powershell - 在文件路径中使用通配符
- logging - 在 Azure 上登录 - 我还需要 NLog(或同等产品)吗
- ios - 自定义 UITextView 自动完成功能
- node.js - Node.js 中 GAE 基本扩展的并发性
- javascript - jQuery 对话框错误:“无法在初始化之前调用对话框上的方法;试图调用方法‘关闭’”
- php - 通过 SOAP Api 在 PHP 中进行 Gzip 压缩
- node.js - 如何记忆 TypeScript getter
- reactive-programming - 两个 Mono 与条件的组合