“DLL load failed” when import cv2 (opencv)

前端 未结 15 1011
萌比男神i
萌比男神i 2020-12-14 08:45

In [windows server 2012 R2 x64, python 3.7 64x]

pip install opencv-contrib-python

installed without any error .
and when I try to impor

相关标签:
15条回答
  • 2020-12-14 09:16

    i was suffering from the same problem "DLL load failed" after reading tons of answers and articles i got a solution.

    i don't know this works for you or not but give it a try.

    tools and versions i used: anaconda - 5.3.1, python - 3.7, win 10 (64 bit)

    Steps i performed :

    step1:i installed opencv 3.4.4 from here then extract into C drive (you can do wherever you want)

    step2: copy cv2.pyd file from [C:\opencv\build\python\cv2\python-3.7] here to [C:\Users\"user-name"\Anaconda3\Lib\site-packages] here.

    step3: run dependency walker to detect which dll files are missing, after running dependency walker in my case it showed two dll files are not loading, they are (1)OPENCV_WORLD344.DLL and (2)IESHIMS.DLL. i don't know about your situation but you can do this-> find files name using dependency walker then find their path and follow step4.

    step4: open System property->Advanced->Environment variables, now edit path and add C:\opencv\build\x64\vc14\bin (in my case this was the place where OPENCV_WORLD344.DLL is stored) and after doing this, import cv2 in python.

    If my answer does not work then add a comment.

    0 讨论(0)
  • 2020-12-14 09:17

    I was having the same issue. I resolved this error by downgrading open cv.

    pip install opencv-python==3.3.0.9

    0 讨论(0)
  • 2020-12-14 09:18

    I was having this problem on Windows Server 2008R2 fresh install and took almost a day to resolve, as was trying with many hits and trials finally I found solution somewhere in internet (not stackoverflow)

    • Installed Windows Media Feature Pack for 2008R2 then installed Server Manager-> Features-> Add Features-> Desktop Experience
    • Server Manager-> Features-> Add Features-> Desktop Experience and Ink and Handwriting Services.

    Besides check list includes

    • Visual C++ redistributable 2015
    • Universal C Runtime

    Hopefully its will help save time

    0 讨论(0)
  • 2020-12-14 09:22

    its worked well for me.* Answer is Need to put cv2.pyd file to your virtual environment. need to put under two folder of envs,

    • first is under DLLS folder and Second is under Lib/site-packages

    To get cv2.pyd > download from this link https://sourceforge.net/projects/opencvlibrary/ and then extract the download file

    You will get opencv folder, after that go inside opencv folder like Downloads\opencv\build\python\2.7 and go one deeper folder depend on your 32 or 64 window version

    Copy cv2.pyd Important **** after copying cv2.pyd file to your envs, you need to rename cv2.pyd to _cv2.pyd

    0 讨论(0)
  • 2020-12-14 09:23

    Python 3.7 may not support some modules.

    • Try installing python 3.6.4
    • Using command prompt, "pip install opencv" or "pip install opencv-python"
    • Import cv2
    0 讨论(0)
  • 2020-12-14 09:26

    All you need is python 3.6. I've been looking for solution for last 3 days and my problem was solved when i installed python 3.6.7. After installing python 3.6 you can simply run pip install opencv-python. Source: https://www.geeksforgeeks.org/setup-opencv-with-pycharm-environment/

    0 讨论(0)
提交回复
热议问题