当我 运行 代码在 VSCode 中的输出显示在终端 window 而不是输出 window

The output when I run code in VSCode gets displayed in the terminal window instead of the output window

我尝试了之前在类似问题中发布的一些解决方案,但 none 似乎对我有用。我的代码在 Python 3.8 中,我使用的是 最新版本的 VSCode。谢谢

当VS Code中运行 python代码时,默认在VS Code内部终端(TERMINAL)执行运行命令。它是一个允许用户交互的终端,但是“OUTPUT”是一个输出终端,不能接收用户输入。

关于如何在 VS Code 的“OUTPUT”中显示输出:

VS Code中请使用“Code Runner”扩展,默认使用“OUTPUT”:

此外,如果想使用比较干净的输出,也可以使用“DEBUG CONSOLE”。

请在“launch.json”中使用:"console": "internalConsole",然后点击F5调试代码:

确保您已安装代码 运行ner 扩展。如果是那么,enter image description here 前往设置 , 1.search 终端 2.滚动到最后一行 3.取消选中终端

中的代码运行