简体   繁体   中英

What's the difference? DLL load failed: %1 is not a valid Win32 application & DLL load failed: The specified module could not be found

I came across both issues these days when working on Python and DLL files. What's the difference between these two ImportErrors?

From my research, I figured out part of the answers to this question.

The first one, DLL load failed: %1 is not a valid Win32 application is probably due to the mix up of the bit version 64 and bit version 32. As such, to my understanding, if I am running a code compiled in Python 2 in Python 3, the problem will happen. The solution to this issue is to use the consistent bit version.

Another one, DLL load failed: The specified module could not be found , is probably caused by:

(1) Inconsistent compile version: the code is compiled with a different compiler (or compiler version) than the binary file that the respective Python module consists of ( reference ). In my case, my code was compiled in Python 3.4, and the error raised when I imported the module in Python 3.6.

(2) The path to the file is misconfigured ( reference )

(3) Some files or "dependencies" are missing ( reference ). For example, need to install the Visual C++ Redistributable for Visual Studio 2015 in some cases.

Please leave your feedback if I was wrong or the answer can be improved. Thank you!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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