open cv module cannot be imported

Question:

While importing OpenCV python by the code below

 import cv2

I can’t import the module instead it gives me an error.

 Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import cv2
  File "C:Users2684jAppDataLocalProgramsPythonPython39libsite-packagescv2__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: DLL load failed while importing cv2: The specified module could not be found.
Asked By: JOHN ARTHUR

||

Answers:

Try the following

pip install opencv-contrib-python
Answered By: The Singularity

So I have tried many ways and I have found an exact problem

here below I have given the steps clearly to solve this problem

  1. first navigate to your python folder
  2. then navigate further to Libsite packagescv2..
  3. then create an folder name cv2 do not change the folder name create a folder with cv2 as its name
  4. leaving the _init_.py file copy all other files into the cv2 folder do not just copy just perform an cut copy paste action

this is the exact way to solve this problem

Answered By: JOHN ARTHUR
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.