Fix: ModuleNotFoundError: No module named ‘opencv’

If you install opencv, you may have tried importing it incorrectly:

import opencv
ModuleNotFoundError: No module named 'opencv'

The correct way is to import cv2 (note this applies even for opencv 3)

import cv2

Additionally, you need to make sure you’re using the version of python (2 or 3) that opencv was installed with – it appears to only work with one or the other.

Interested in Python? I send out weekly, personalized emails with articles and conference talks. Click here to see an example and subscribe.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *