Search code examples
pythonopencv

DLL load failed error when importing cv2


I have installed opencv on my windows machine using python 3.6 without any issues, using:

pip install opencv-python

but when I try to import cv2 I get the following error

ImportError: DLL load failed: The specified module could not be found.

I have seen this post

It says cv2 doesn't work with python 3 I was wondering if this has been fixed or if there is a way around it


Solution

  • You can download the latest OpenCV 3.2.0 for Python 3.6 on Windows 32-bit or 64-bit machine, look for file starts withopencv_python‑3.2.0‑cp36‑cp36m, from this unofficial site. Then type below command to install it:

    • pip install opencv_python‑3.2.0‑cp36‑cp36m‑win32.whl (32-bit version)
    • pip install opencv_python‑3.2.0‑cp36‑cp36m‑win_amd64.whl (64-bit version)

    I think it would be easier.

    Update on 2017-09-15:

    OpenCV 3.3.0 wheel files are now available in the unofficial site and replaced OpenCV 3.2.0.

    Update on 2018-02-15:

    OpenCV 3.4.0 wheel files are now available in the unofficial site and replaced OpenCV 3.3.0.

    Update on 2018-06-19:

    OpenCV 3.4.1 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support, and replaced OpenCV 3.4.0.

    Update on 2018-10-03:

    OpenCV 3.4.3 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support, and replaced OpenCV 3.4.1.

    Update on 2019-01-30:

    OpenCV 4.0.1 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support.

    Update on 2019-06-10:

    OpenCV 3.4.6 and OpenCV 4.1.0 wheel files are now available in the unofficial site with CPython 3.5/3.6/3.7 support.

    Update on 2023-02-11:

    OpenCV 4.5.5 wheel files are now available in the unofficial site with CPython 3.7/3.8/3.9/3.10/3.11 support.