保留 Pyinstaller 创建的 exe 文件的错误信息

Keep error message of exe file which is created by Pyinstaller

我正在使用 Pyinstaller 从 Python 源代码创建 exe 文件,当 exe 为 运行

时我保留 cmd window
python pyinstaller.py --onefile script.py

每当出现错误时,cmd 上都会显示错误 window 但很快就会消失,有什么方法可以在 cmd 上保留错误消息 window?

创建批处理文件。在里面,放:

C:\path\to\your\file.exe
pause

然后双击批处理文件。或者,只需打开 cmd window,导航到包含 exe 和 运行 yourExe.exe.

的目录