[PYTHON] VS Code says there is an error in cv2

Overview

I was writing a python program in Visual Studio Code. It is a story that a red line appears in the code when using the OpenCV library. スクリーンショット 2020-10-29 17.10.30.png

Module 'cv2' has no 'imread' member

Operating environment

MacOS Catalina Visual Studio Code 1.39.2 python 3.8.5 opencv-python 4.4.0

Confirmation

By the way, cv2 is included. Let's first make sure it's not an error here.

import cv2

If you get an error with this sentence, cv2 is not included. Do the following in your terminal:

$brew install opencv
$pip install opencv-python

Solutions

Open VS Code settings. Code -> Preferences -> Settings スクリーンショット 2020-10-29 17.12.42.png

After opening the settings, enter the following in the search window above to search.

python.linting.pylintEnabled

Please uncheck the items that appear. スクリーンショット 2020-10-29 17.14.38.png

result

It has disappeared. スクリーンショット 2020-10-29 17.15.47.png

The end

Recommended Posts

VS Code says there is an error in cv2
[Note] VS Code cv2 intellisense error
Write Spigot in VS Code
Resolve VS Code unresolved import error
There is no switch in python
An error occurred in scikit-learn imputer
Python in is also an operator
The story of an error in PyOCR
(For myself) Put Flask in VS Code
Pass PYTHONPATH in 1 minute with VS Code
VS Code Pylint is annoying with import! !! !! !!
Is there NaN in the pandas DataFrame?
Is there a good sample code for nosetests?
[Django] Error when SlugField is specified in .filter ()
Use Python in Anaconda environment with VS Code
I tried to build an environment with WSL + Ubuntu + VS Code in a Windows environment
What to do if Python IntelliSense is not displayed in VS Code on Windows
Error display (unresolved import'hoge') when importing self-made module does not disappear in VS Code