Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Import Error: cannot import name 'cv2'

I want to begin exploring OpenCV in Python but I'm stuck at importing the package cv2. I have installed the package through pip3 install opencv-python and it got installed at this location - C:/Users/Kshitiz/AppData/Local/Programs/Python/Python36-32/Lib/site-packages.

When I'm trying to import cv2 using this:

import sys
sys.path.append('C:/Users/Kshitiz/AppData/Local/Programs/Python/Python36-32/Lib/site-packages')
import cv2

It gives the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:/Users/Kshitiz/AppData/Local/Programs/Python/Python36-32/Lib/site-packages\cv2\__init__.py", line 7, in <modul
e>
    from . import cv2
ImportError: cannot import name 'cv2'

I have searched a lot but cannot find anything relevant. Please suggest what needs to be done. Thanks.