程序运行良好,包括win32gui调用,但可执行文件会导致此错误。
File "Client.py", line 1, in <module>
ImportError: DLL load failed while importing win32gui: Le module spécifié est introuvable.
[4628] Failed to execute script Client```
I am running on :
Win 10
Python 3.8发布于 2020-04-09 21:44:35
问题是隐藏导入
因此,如果有人遇到同样的问题,您需要在构建可执行文件时添加缺少的模块,如下所示:
pyinstaller pathToYourPythonFile/script.py --onefile --hidden-import theMissingModule就我的情况而言,缺少的模块是win32gui。修复后,它是另一个:screenshot_every从d3dshot库
因此,基本上,如果它是一个子导入,您将面临这个问题,即:
from d3dshot import screenshot_every
因此,screenshot_every是隐藏的导入(您需要这样做,以减少,即.exe大小)
发布于 2021-10-14 10:24:08
Win32gui与python-3.7或更高版本不兼容
python-3.7于2018年发布,win32gui的最新版本于2017年8月发布。
安装pywin32。这就给了你win32gui
$pip install pywin32
import win32apihttps://stackoverflow.com/questions/61130284
复制相似问题