简体   繁体   English

python无法在64位Windows上加载64位DLL

[英]python failed to load 64 bit DLL on a 64 bit Windows

I wa testing a small python program that called underlying DLL libs. 我正在测试一个称为基础DLL库的小型python程序。

My system is 64bit windows 7. The python executable is the one shipped with 64 bit Anaconda3, kicked off inside Anaconda's virtual environment. 我的系统是64位Windows7。python可执行文件是随Anaconda虚拟环境启动的64位Anaconda3附带的文件。

First thing came to my attention is that this python code 首先引起我注意的是这段python代码

sys.platform

return win32 even for a AMD64 Arch, "platform.machine()" seemed returning a more accurate result. 即使对于AMD64 Arch也返回win32,“ platform.machine()”似乎返回了更准确的结果。

Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] on win32

I did find some SO posts discussing this issue, such as this one . 我确实找到了一些讨论该问题的SO帖子,例如this

and then the program failed when trying to load a DLL file: 然后在尝试加载DLL文件时程序失败:

windll.LoadLibrary(realpath(join(_module_location, 'dlh', 'win64', 'I_cant_tell_you_the_name.dll')))

Error message: 错误信息:

OSError: [WinError 193] %1 is not a valid Win32 application

Question is, why python can't load a 64 bit DLL in a 64 bit environment? 问题是,为什么python无法在64位环境中加载64位DLL? it seemed to me the compiler insisted on loading a 32 bit DLL instead. 在我看来,编译器坚持改为加载32位DLL。 Why is that? 这是为什么? Or that the venv that Anaconda created support only 32 bit code? 还是Anaconda创建的venv仅支持32位代码?

Unfortunately I didn't have a 32 bit DLL for testing, otherwise I'd like to see how that went. 不幸的是,我没有用于测试的32位DLL,否则我想看看效果如何。

You can use Dependency Walker to check what's happening. 您可以使用Dependency Walker来检查正在发生的事情。 It has a profiling feature that will trace all library loads. 它具有可跟踪所有库加载的配置文件功能。

A few possible issues it can show you: 它可能会向您显示一些可能的问题:

  1. Python is 32-bit because the wrong version was executed Python是32位的,因为执行了错误的版本
  2. The DLL is 32-bit somehow DLL是32位的
  3. The DLL depends on other DLLs that are not in the path 该DLL依赖于不在路径中的其他DLL

暂无
暂无

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

相关问题 Python pylab ImportError:DLL加载失败Windows 7 64位 - Python pylab ImportError: DLL load failed Windows 7 64 Bit 导入cv2:ImportError:DLL加载失败:Windows 7 Anaconda 4.3.0(64位)Python 3.6.0 - Import cv2: ImportError: DLL load failed: windows 7 Anaconda 4.3.0 (64-bit) Python 3.6.0 Windows 10,Python 3.6和64位上的Tensorflow的DLL加载失败 - DLL load failed for Tensorflow on Windows 10, Python 3.6 and 64-bit 导入CV2:DLL加载失败(Windows 64位中的Python) - Import CV2: DLL load failed (Python in Windows 64bit) 在TRACE上使用Mercurial时,这一次在Windows 2008 R2(64位)上,在“需求导入”中获取“ DLL加载失败”或python异常 - Getting either “DLL load failed” or python-exception in demandimport, when using mercurial on trac, this time on Windows 2008 R2, 64 bit 64位cx_Oracle:DLL加载失败 - 64-bit cx_Oracle: DLL load failed win10 pro 64 bit + python 3.6.0 ImportError: DLL load failed: The specified module could not be found - win10 pro 64 bit + python 3.6.0 ImportError: DLL load failed: The specified module could not be found ImportError:DLL加载失败:操作系统无法运行%1。 Python 2.7.12 | Anaconda 4.2.0(64位) - ImportError: DLL load failed: The operating system cannot run %1. Python 2.7.12 |Anaconda 4.2.0 (64-bit) 64位python 2.5 / 2.6 + windows 7“导入套接字”DLL加载错误 - 64-bit python 2.5/2.6+windows 7 “import socket” DLL load error 64位Windows计算机上的32位python - 32 bit python on 64 bit windows machine
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM