这比预期的更难搞清楚,但和往常一样,一旦你知道了就很简单了。
快速回答。
在解决方案资源管理器中,右键单击项目并选择“属性”。在“常规”选项卡上,选中“Windows应用程序”旁边的复选框。
然后保存并关闭“属性”窗口。完成!The typical way to hide the Python console window is to set the
Windows Application property (in the project properties window), which
will then run pythonw.exe instead of python.exe. This is only really
an option if you don't provide any input while your program is running
- the output window in VS is not a console and does not support typing into your program. Also, this option is per-project, so you'll have to
set it for each project. (It also seems to not be working in our
latest builds, so we'll fix that asap...)
The other option is to stop printing output in Visual Studio and only
use the console window. If you are suffering performance issues, this
is more likely to solve the problem. To do this, open
Tools->Options->Python Tools->Advanced and deselect "Tee program
output to Debug Output window". You will probably also want to select
"Wait for input when process exits normally" while you are here. Now
all output will go to the Python console (you can right-click the
title bar and choose Properties to make it bigger), which will be
faster.