Pyinstaller Packaging Issues

Documenting some cross-platform issues I encountered while packaging client applications with Pyinstaller.

Windows 7 Compatibility Issues

1
LoadLibrary: PyInstaller FormatMessageW failed.

Starting from Python 3.9, Windows 7 is no longer supported. If the software needs to run on Windows 7, the highest Python environment is 3.8.

Missing Dynamic Runtime Libraries in Win 7

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

Fix what’s missing - put the DLL file in the program’s root directory folder, or in C:/windows/System32. Generally, this problem does not occur in isolation but because Pyinstaller did not include some dynamically loaded libraries during packaging.

Missing Parts of Dynamic Loading in QT

1
ImportError: DLL load failed while importing QtGui:

Solution one: Put the Sitepackages/QtGui from your environment into the program’s root folder. Solution Two: 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.

pyinstaller could not get source code

Search backward in the error log, manually copy the missing environment packages to the program’s root directory, or specify these missing packages using hidden-import during packaging.

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