cv2 python has no imread member

Since you are trying to executing this with VS Code, try following steps

(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"]

this must work


I tried so many hacks. They were not working. Someone suggested:

from cv2 import cv2

I think this is the best solution to this problem


If you could run your code by selecting "Run Python File In Terminal", it is possibly a bug from an extension of VS Code. See the issue for details

I think you could disable/uninstall the extension from your machine or ignore it.