简体   繁体   English

导入cv2 ImportError:DLL加载失败:%1不是有效的Win32应用程序

[英]import cv2 ImportError: DLL load failed: %1 is not a valid Win32 application

I have seen : ImportError: DLL load failed: %1 is not a valid Win32 application. 我已经看到: ImportError:DLL加载失败:%1不是有效的Win32应用程序。 But the DLL's are there 但是DLL在那里

And a couple of other solutions that suggest placing the \\opencv\\build\\python\\2.7\\x86\\cv2.pyd to my Anaconda virtual environment's \\Lib\\site-packages , I am working with Anaconda3 and in my environment I have Python version as below: 以及其他一些建议将\\opencv\\build\\python\\2.7\\x86\\cv2.pyd到我的Anaconda虚拟环境的\\Lib\\site-packages ,我正在使用Anaconda3,并且在我的环境中,我使用Python版本下面:

Python 2.7.15 |Anaconda, Inc.| (default, May  1 2018, 18:37:12) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.

Strangely, despite replacing the file at every possible location of Python in my Windows 10 system, I fail to run the script which uses import to opnecv. 奇怪的是,尽管在Windows 10系统中Python的每个可能位置都替换了文件,但我无法运行使用import导入opnecv的脚本。

You're using the 32 bit version of Anaconda as we can see from the Python output. 从Python输出中可以看到,您正在使用Anaconda的32位版本。 Then you have downloaded the 64 bit version of OpenCV according your comment. 然后,根据您的评论下载了64位版本的OpenCV。

You can't mix 32 bit and 64 bit applications. 您不能混合使用32位和64位应用程序。 It's not possible in Windows in general, neither in Python, nor in C#, nor in C++ or any other programming language. 通常,在Windows,Python,C#,C ++或任何其他编程语言中,这都是不可能的。

So you have 2 options now: 因此,您现在有2个选择:

  • get a 64 bit version of Python that works with your OpenCV. 获得与您的OpenCV兼容的64位版本的Python。 Eg on the Anaconda download site look for a win-64 version. 例如,在Anaconda下载网站上,寻找win-64版本。 Your output should then look like 您的输出应如下所示

     Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32 

    Note that the on win32 at the end is a bit confusing and just means "on the Windows platform" 请注意,最后的on win32有点令人困惑,仅表示“在Windows平台上”

  • get a 32 bit version of OpenCV that works with your Python 获得与您的Python兼容的32位版本的OpenCV

暂无
暂无

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

相关问题 ImportError:DLL加载失败:不是有效的Win32应用程序 - ImportError: DLL load failed: not a valid Win32 application 'matplotlib'ImportError:DLL加载失败:%1不是有效的Win32应用程序 - 'matplotlib' ImportError: DLL load failed: %1 is not a valid Win32 application Tensorflow 导入错误:DLL 加载失败:%1 不是有效的 Win32 应用程序 - Tensorflow ImportError: DLL load failed: %1 is not a valid Win32 application 导入错误:DLL 加载失败:%1 不是有效的 Win32 应用程序 - ImportError: DLL load failed: %1 is not a valid Win32 application PyBluez 导入错误:DLL 加载失败:%1 不是有效的 Win32 应用程序 - PyBluez ImportError: DLL load failed: %1 is not a valid Win32 application ImportError:DLL加载失败:%1不是有效的Win32应用程序-paramiko - ImportError: DLL load failed: %1 is not a valid Win32 application - paramiko ImportError:DLL加载失败:%1不是有效的Win32应用程序 - ImportError: DLL load failed: %1 is not a valid Win32 application ImportError:无法导入名称_hierarchy或DLL加载失败:%1不是有效的Win32应用程序 - ImportError: cannot import name _hierarchy or DLL load failed: %1 is not a valid Win32 application 导入理解(来自sciTools)给出ImportError:DLL加载失败:%1不是有效的Win32应用程序 - import understand (from sciTools) gives ImportError: DLL load failed: %1 is not a valid Win32 application ImportError:DLL加载失败:%1不是有效的Win32应用程序(原始筛网导入) - ImportError: DLL load failed: %1 is not a valid Win32 application (prime sieve import)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM