Pyinstaller Packaging Issues

Documenting some cross-platform issues I encountered when using pyinstall to package client applications.

1 Windows 7 Adaptation Issue

1
LoadLibrary: PyInstaller FormatMessageW failed.

Python 3.9 and above no longer support Windows 7. If the software needs to run on Windows 7, the Python environment should be limited to version 3.8.

2 Missing Dynamic Runtime Libraries on Windows 7

1
Unable to start this program because api-ms-win-core-path-l1-1-0.dll is missing from your computer. Try reinstalling the program to fix this problem.

Replace what’s missing by placing the DLL file into the program’s root directory or into C:/windows/System32. However, this issue usually does not occur alone, as some dynamically loaded libraries were not included during PyInstaller packaging.

3 Partial Missing Qt Dynamic Loading

1
ImportError: DLL load failed while importing QtGui:

Solution 1: Place Sitepackages/QtGui from the environment into the program’s root directory.
Solution 2: Use the packaging command pyinstaller main.py --noconsole --hidden-import PySide6.QtXml -F -p C:\Windows\System32\downlevel -p C:\Windows\System32 to manually load the missing modules by specifying hidden-import.

4 pyinstaller could not get source code

Look backwards in the error log, manually copy the missing environment packages to the program’s root directory, or use hidden-import to specify the import of these missing packages during packaging.

Buy me a coffee~
Tim AlipayAlipay
Tim PayPalPayPal
Tim WeChat PayWeChat Pay
0%