python - Pyinstaller导入错误: DLL load failed while importing win32gui

标签 python dll pyinstaller pywin32 win32gui

程序工作正常,包括 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

最佳答案

问题是隐藏导入

因此,如果有人遇到同样的问题,您需要在构建可执行文件时添加缺少的模块,如下所示:

pyinstaller pathToYourPythonFile/script.py --onefile --hidden-import theMissingModule

就我而言,缺少的模块是win32gui。修复后,又是一个:来自 d3dshotscreenshot_every 图书馆

所以基本上,如果它是一个子导入,你会遇到这个问题:

从 d3dshot 导入 snapshot_every

所以 snapshot_every 是隐藏导入(您需要执行此操作来减少.exe大小)

关于python - Pyinstaller导入错误: DLL load failed while importing win32gui,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61130284/

相关文章:

linux - 我怎样才能让 pyinstaller 在 Ubuntu 上工作?

python - 如何根据前面的 x、y x 方向和 y 方向让 .Rect 跟随另一个?

python - 如何正确计算 tf.nn.weighted_cross_entropy_with_logits pos_weight 变量

python - 散列一系列值

c++ - 如何以编程方式获取 MSVC 中任何类型的函数的修饰名称

python-3.x - pyinstaller 和 geckodriver 在编译为 exe 后生成问题

python - 在 python 中读取音频流

.net - 将 .NET 程序集类型库导入 Delphi 不会生成过程

java - 如何从java代码调用外部dll函数

python - pyinstaller 错误 - AttributeError : module 'pytest' has no attribute 'freeze_includes'