简体   繁体   English

为Python 2.7安装opencv时DLL加载失败错误

[英]DLL Load failed error when installing opencv for Python 2.7

I am using Windows Server 2012 R2 and Python 2.7, precisely: 我正使用Windows Server 2012 R2和Python 2.7:

Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:22:17) [MSC v.1500 32 bit (Intel)] on win32 在Win32上的Python 2.7.15(v2.7.15:ca079a3ea3,Apr 30 2018,16:22:17)[MSC v.1500 32位(Intel)]

the recent version of OpenCV library 3.4.2 isn't working and it produces the following error: 最新版本的OpenCV库3.4.2无法正常工作,并且会产生以下错误:

>>> import cv2

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import cv2
  File "C:\Python27\lib\site-packages\cv2\__init__.py", line 3, in <module>
    from .cv2 import *
ImportError: DLL load failed: The specified module could not be found.

So I downloaded older version OpenCV 3.4.1, copied cv2.pyd to C:/Python27/lib/site-packages and viola it works! 所以我下载了旧版本的OpenCV 3.4.1,将cv2.pyd复制到了C:/ Python27 / lib / site-packages,并且中提琴可以正常工作!

Now is this my fail or theirs? 现在这是我的失败还是他们的失败? I downloaded VC++ x86 Redistributable 2015 and 2017, Python is also 32-bit, and I'm using a 32-bit version of OpenCV lib, so I don't think that's my issue, what's going on, does anyone know? 我下载了VC ++ x86 Redistributable 2015和2017,Python也是32位的,并且我使用的是32位版本的OpenCV lib,所以我不认为这是我的问题,这是怎么回事,有人知道吗?

Try installing with pip? 尝试使用pip安装吗? I've never had an issue with a pip installation of cv2. 我从来没有关于cv2的pip安装问题。

pip install opencv-python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM