-1

I have installed the cv2 package, via command prompt with pip install opencv-python command, & it installed successfully. But when I tried the following code, it didn't recognized the VideoCapture() object. Can anyone help me?

import cv2

capture = cv2.VideoCapture(0)

When runs, it gives the following error:

ImportError: DLL load failed while importing cv2: The specified module could not be found.
HansHirse
  • 18,010
  • 10
  • 38
  • 67
  • [Have you tried this?](https://stackoverflow.com/q/43184887/15981043) – ALai Jun 18 '21 at 07:34
  • Reinstalling also helps sometimes. – yakhyo Jun 18 '21 at 07:35
  • Welcome to Stack Overflow. I just want to let you know that you should edit your questions instead of re-posting them with slight changes. What can happen if too many of your question are closed and downvoted is that the account receives a [question ban](https://meta.stackexchange.com/questions/8699) so you want to be carefully and wait for someone knowledgeable to reply. It's also advisable to pay careful attention to the information in the comments, because sometimes the question is solved with a simple comment. – bad_coder Jun 18 '21 at 18:11
  • Besides the thread linked in the first comment, make sure you [activate the venv](https://docs.python.org/3/tutorial/venv.html#creating-virtual-environments) you are installing to and also that you [set the interpreter/venv in the IDE](https://stackoverflow.com/questions/19885821/how-do-i-use-installed-packages-in-pycharm) – bad_coder Jun 18 '21 at 18:14

1 Answers1

0

Try to install trough pip in your terminal this:

For 32 system version: pip install opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl

For 64 system version: pip install opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl

jumorap
  • 61
  • 4