0

I am a beginner in terms of using python. Currently, I got python 3.7 and I am using anaconda as IDE. For my project, I need to detect the location and brightness of points/dots in an external imported picture. I figure I could use the modul OpenCV. Unfortunately, I am stuck right now with the problem to import the module cv2. I already successfully installed the package using

python -m pip install OpenCV-python

on command prompt. OpenCV Version which was installed is 4.2.0.34. While compiling the test script of OpenCV on Spyder

import cv2
print(cv2.__version__)

I got this message

"ImportError : DLL load failed : The Modul was not found." 

Can somebody let me know please how to fix this problem? Is somehow the version of OpenCV I got not compatible with the Python version? I already watched and followed many tutorial videos on Youtube, but I couldn't find the solution. I tried to copy the cv2.pyd to the site-packages folder in

C:/user/Anaconda3/Lib/site-packages directory

still it didn't fix the problem...

I would appreciate any answers and help I could get here. Thank you!

Dhaval Taunk
  • 1,662
  • 1
  • 9
  • 17
  • Are you on the correct virtual environment? Have you created a virtual environment other than `base`? To see a list of enviroments use `conda info --envs` in terminal, and you should read this to understand conda/enviroments better. [link](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#viewing-a-list-of-your-environments) – Ahmet Jun 02 '20 at 19:08
  • i never changed the environment, or create one. On the list of the environments, there's no opencv or cv2. – pythonanfänger Jun 02 '20 at 23:15

2 Answers2

1

try installing it using these commands in the following order:

conda update anaconda-navigator
conda update navigator-updater
pip install opencv-python

It should work fine.

Alisha Maini
  • 99
  • 2
  • 12
0

Try conda install opencv or conda install -c menpo opencv

bonfab
  • 302
  • 2
  • 8
  • i tried both commands on Anaconda prompt. still didn't work :( – pythonanfänger Jun 02 '20 at 23:14
  • Did you activate your environment? Otherwise you can also install with pip, though should only be used as last resort in a conda environment https://stackoverflow.com/questions/41060382/using-pip-to-install-packages-to-anaconda-environment – bonfab Jun 03 '20 at 06:59