【问题标题】:Python and pylint in VSCodeVSCode 中的 Python 和 pylint
【发布时间】:2020-10-28 20:13:51
【问题描述】:

在我的 VSCode 编辑器上,我在 conda 上运行 venv。
venv 中的 Python 版本是 3.8。
将包 OpenCV 导入为 import cv2 吐出 pylint 错误,例如
Module 'cv2' has no 'xyz' member
但是使用from cv2 import cv2 导入包运行得非常好。为什么会这样?在我的 ubuntu 机器上的 vscode 上永久纠正这个问题的方法是什么?

【问题讨论】:

  • 进展如何?如果有任何进展,请告诉我们。

标签: python opencv visual-studio-code package pylint


【解决方案1】:

根据你提供的信息,我在电脑上安装了模块“opencv”,使用时VSCode没有显示pylint错误:

我安装模块“opencv”的方式:pip install opencv-python

我的settings.json

{
  "terminal.integrated.shell.windows": "C:\\windows\\System32\\cmd.exe",
    "workbench.iconTheme": "vscode-icons",
    "files.autoSave": "afterDelay",
    "files.autoSaveDelay": 1000,
    "python.linting.enabled": true, 
    "python.linting.pylintEnabled": true,
    "python.languageServer": "Pylance",
}

参考:Opencv-python

【讨论】:

    猜你喜欢
    • 2018-01-01
    • 1970-01-01
    • 2020-10-09
    • 2021-06-18
    • 2020-05-18
    • 2019-09-25
    • 2021-06-07
    • 1970-01-01
    • 2020-10-16
    相关资源
    最近更新 更多