I had the same problem and spent 3 full days fighting it. I tried everything that was offered: update pip, update Visual C ++, update Anaconda, manually upload files and almost all the solutions that I could find on the Internet. Here is what finally worked, maybe it will help someone else:
1- I refused the downloads based on Python 3 and Anaconda, as I noticed that they had several problems, and instead downloaded the bits of Python 2.7.16 6 4-.
2- Moved to where Pip was on my disk (for me, the path is C: \ Python27 \ Scripts), highlighting the path, selecting it, and typing "cmd", then enter so that the command line opens on this path (I noticed a skip of this usually leads to a couple of errors)
3- Updated Pip using python -m pip install --upgrade pip on CMD (again, skipping this and not updating, I did not skip this procedure)
4- I downloaded the corresponding Wheel file from https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv (after several attempts, the one that worked for me was opencv_python-2.4.13.7-cp27-cp27m-win_amd64. whl) I copied and pasted it into the same folder that Pip was in (C: \ Python27 \ Scripts for me), and then installed it via CMD using: pip install opencv_python-2.4.13.7-cp27-cp27m-win_amd64.whl . It always opens through CMD along this path, as shown in step 2
5- After step 4, when I imported OpenCV using import cv2 I no longer had a DLL error, but there was a numpy-related error (since I just installed this version of Python and therefore Numpy has not been installed yet). I installed numpy by typing pip install numpy and voila! The problem was resolved, and OpenCV was imported correctly.
Hope this helps someone.
Metrician Apr 03 '19 at 15:28 2019-04-03 15:28
source share