My frozen Python files are working on my computer correctly. I froze them with cx_freeze
, but on some computers they do not work. For example in Windows 7, it always needs DLL files, it says they are missing. It is usually about api-ms-win
DLL files.
In Windows 10, it shows this error:
But on my computer, it works correctly. How is this possible, and how can I fix it?
There are many potential problems, but the most common with Python 3.5+ and Windows 10 seems to be missing api-ms-win
dlls.
To help my Python freeze program to find required DLLs:
Here is one set of notes from the pyinstaller
issue tracker:
Add the directory of the required dlls to system Path. My application uses PyQt5 which is dependent on api-ms-win dlls.
For PyQt5 add this directory:
%WHERE EVER YOU INSTALLED PYTHON%\Lib\site-packages\PyQt5\Qt\bin
For api-ms-win dlls you need Visual Studio 2015 OR Windows SDK (download here): Directory if you have Visual Studio: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Remote Debugger\x64 Directory if you have Windows SDK: C:\Program Files (x86)\Windows Kits\10\Redist\ucrt\DLLs\x64
After you add the required paths, pyinstaller can find the files.
(SOURCE)
But what DLL's are missing?
Too help find any missing DLLs, you can use Dependency Walker to find all of the DLL's that your program needs.
Should I use Pyinstaller instead?
It is often worth trying some of the other freeze utils if the one you are using is not cooperating.