如何让我在 python 中的控制台不关闭? [英] how to make my console in python not to close?
问题描述
我正在从 Windows 使用 python 制作一个应用程序.当我在控制台中运行它时,它会停止、显示错误并关闭.我看不到错误,因为它太快了,我无法阅读.我正在用 IDLE(我安装时 python 附带的程序)编辑代码,当我用 python shell 运行它时,没有错误.我会从 IDLE 运行它,但是当我使用控制台时,它具有更多功能.
I'm making a application in python from Windows. When I run it in the console, it stops, shows an error, and closes. I can't see the error becase its too fast, and I can't read it. I'm editing the code with IDLE (the program that came with python when I instaled it), and when I run it with the python shell, there are no errors. I would run it from IDLE, but when I use the console, it has more features.
我不知道为什么会这样.我需要你的帮助.
I don't know why this is happening. I need your help.
推荐答案
从 Windows 命令提示符运行您的程序.程序完成后不会自动关闭.
Run your program from a Windows command prompt. That will not automatically close when the program finishes.
如果您通过双击 .py
文件图标运行您的程序,那么 Windows 将在您的程序完成时关闭该窗口(无论是否成功).
If you run your program by double-clicking on the .py
file icon, then Windows will close the window when your program finishes (whether it was successful or not).
这篇关于如何让我在 python 中的控制台不关闭?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!