I came across both issues these days when working on Python and DLL files. What's the difference between these two ImportErrors?
-
It might be because you don't seem to be asking a question. Rather, you are asking/answering the question at the same time. It might be best to edit the question into an actual question and then post your findings as an answer instead? – DavidG Aug 05 '20 at 14:05
-
Thanks for your feedback! – Tyrion Aug 05 '20 at 14:45
1 Answers
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!

- 405
- 8
- 22