Python – OpenCV VSCode problems fix

Table of Contents

Intro

If your VSCode gives you Problems while import cv2 and can’t use autoComplete with it, here is you fix.

Instructions

Solution

    1. On VScode: CTRL + Shift + P
    2. Choose “Preferences: Open Settings (JSON)”
    3. Add this line into JSON file:
      "python.linting.pylintArgs": ["--generate-members"]
    4. Done, it works for meΒ πŸ‘

settings.json

				
					    "python.linting.pylintArgs": [
        "--generate-members"
    ]
				
			

Example Code

				
					import cv2
import numpy

img = numpy.zeros([320, 320], numpy.uint8)
cv2.imshow("test", img)
cv2.waitKey()
cv2.destroyAllWindows()
				
			

Leave a Comment