Home > Enterprise >  open cv module cannot be imported
open cv module cannot be imported

Time:09-17

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:\Users\2684j\AppData\Local\Programs\Python\Python39\lib\site-packages\cv2\__init__.py", line 5, in <module>
    from .cv2 import *
ImportError: DLL load failed while importing cv2: The specified module could not be found.

CodePudding user response:

Try the following

pip install opencv-contrib-python

CodePudding user response:

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 Lib\site packages\cv2..
  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

  • Related