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

Nin*_*gxi 1 python pyinstaller

我正在使用Pyinstaller从Python源代码创建exe文件,并且在exe运行时保留cmd窗口

python pyinstaller.py --onefile script.py
Run Code Online (Sandbox Code Playgroud)

只要有错误,该错误就会在cmd窗口中显示,但是很快就会消失,是否有任何方法可以将错误消息保留在cmd窗口中?

Dar*_*der 6

创建一个批处理文件。在其中放入:

C:\path\to\your\file.exe
pause
Run Code Online (Sandbox Code Playgroud)

并双击批处理文件。或者,只需打开一个cmd窗口,导航到包含exe的目录并运行yourExe.exe