Pyinstaller 出现错误 -"failed to execute script "

Pyinstaller getting error -"failed to execute script "

Please check this Image to see the problem

我已使用 pyinstaller 转换为 exe 文件,但未 运行ning 并在命令行中显示此错误。请告诉我怎么做运行。在 python 程序中我有一张图标图片和一个 excel 文件。此外,我正在 运行 从存在图标和 excel 的同一文件夹中安装 exe,这意味着我已将 .exe 从 dist 文件夹复制到主文件夹。请帮助我。

我认为问题出在您的代码中

如果您想轻松地将 .py 转换为 .exe,请尝试使用 auto-py-to-exe,它是一个漂亮的 GUI,可以将 py 转换为 exe,它可能会对您有所帮助

我自己得到了答案(是不是很有趣) 要了解解决方案,请观看此视频 - https://youtu.be/2gu5stlEtms

他修改了 .spec 文件并添加了 python 不会自动完成的导入。这一定会对你有所帮助