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.
From https://pypi.python.org/pypi/opencv-p... :
Q: Import fails on Windows to some DLL load error?
A: If the import fails on Windows, make sure you have Visual C++ redistributable 2015 installed. If you are using older Windows version than Windows 10 and latest system updates are not installed, Universal C Runtime might be also required.
See also this issue if you are using Anaconda.
Q: I have some other import errors?
A: Make sure you have removed old manual installations of OpenCV Python bindings (cv2.so or cv2.pyd in site-packages).