PyLint not recognizing cv2 members

后端 未结 6 878
忘掉有多难
忘掉有多难 2020-12-01 03:15

I am running pylint on an opencv project and I am getting many pylint errors in VS code about members not being present.

Example code:

import cv2
cv         


        
6条回答
  •  佛祖请我去吃肉
    2020-12-01 04:01

    1. On VScode: CTRL + Shift + P
    2. Choose "Preferences: Open Settings (JSON)"
    3. Add this line into JSON file: "python.linting.pylintArgs": ["--generate-members"]

    Done, it works for me

    Note: Make sure you choose "Preferences: Open Settings (JSON)", not "Preferences: Open Default Settings (JSON)"

    Setting File would look like

    {
    "workbench.iconTheme": "vscode-icons",
    "python.dataScience.sendSelectionToInteractiveWindow": true,
    "kite.showWelcomeNotificationOnStartup": false,
    "python.dataScience.askForKernelRestart": false,
    "python.dataScience.jupyterServerURI": "local",
    "python.pythonPath": "/usr/bin/python3",
    "workbench.colorTheme": "Monokai",
    "vsicons.dontShowNewVersionMessage": true,
    "python.linting.pylintArgs": ["--generate-members"] }
    

提交回复
热议问题