'Python app: [WinError 87] on Win7 but not on Win10

I have a Python/Qt portable application that runs fine on Windows 10 (64-bit) but gets this error on Windows 7 (64-bit). What is the problem and is there anything I can hack to make the distributed package run on Windows 7?

Failed to execute script 'pyiboot01_bootstrap' due to unhandled exception:
 [WinError 87] The parameter is incorrect

Traceback (most recent call last):
File "PyInstaller\loader\pyiboot01_bootstrap.py", line 106, in <module>
File "PyInstaller\loader\pyimod04_ctypes.py", line 27, in install
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "PyInstaller\loader\pyimod03_importers.py", line 495, in exec_module
File "ctypes\__init__.py", line 468, in <module>
File "ctypes\__init__.py", line 443, in __getattr__
File "ctypes\__init__.py", line 373, in __init__
OSError: [WinError 87] The parameter is incorrect


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source