简体   繁体   English

使用 Python 时如何摆脱 Vscode 终端中显示的路径?

[英]How can I get rid of the path shown in Vscode terminal while using Python?

When I try running a python code the output terminal displays the location where.py file is located in the white-colored text followed by the "&" sign and then the place where Python is installed as well as the file containing the Python code in blue text. When I try running a python code the output terminal displays the location where.py file is located in the white-colored text followed by the "&" sign and then the place where Python is installed as well as the file containing the Python code in蓝色文本。 I have no problem with the white text but earlier my VScode did not display this blue text, it's cluttering the output, is there any way to get rid of it.我对白色文本没有问题,但早些时候我的 VScode 没有显示这个蓝色文本,它把 output 弄乱了,有什么办法可以摆脱它。 https://i.stack.imgur.com/CUeL4.jpg https://i.stack.imgur.com/CUeL4.jpg

At present, there is no direct way to omit the path information of "Terminal" in VS Code.目前没有直接的方法可以在VS Code中省略“Terminal”的路径信息。 This information shows us the path of the python interpreter used and the path of the executed file when executing the run command.该信息向我们显示了使用的 python 解释器的路径以及执行运行命令时执行文件的路径。

Workarounds:解决方法:

  1. Please use the setting in " launch.json ": "console": "internalConsole", then click F5 to debug the code, "DEBUG CONSOLE" will only display the result.请使用“ launch.json ”中的设置: "console": "internalConsole",然后按F5调试代码,“DEBUG CONSOLE”只会显示结果。

  2. You could use the VS Code extension "Code Runner" and use the settings in " settings.json ": "code-runner.showExecutionMessage": false, then click "Run Code":您可以使用 VS Code 扩展“Code Runner”并使用“ settings.json ”中的设置: "code-runner.showExecutionMessage": false,然后单击“Run Code”:

    在此处输入图像描述

Reference: Python debug configurations in Visual Studio Code .参考: Python Visual Studio Code 中的调试配置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何摆脱终端中显示的(基本)环境前缀 - How to get rid of (base) environment prefix shown in terminal Vscode 显示 Python 2.7.16 ... 我如何更改为 3.8? - Vscode shown Python 2.7.16... How can I change to 3.8? 当我在 VScode 中使用 python 在终端中写入时,我永远无法像教程那样在终端中写入。 我该如何解决? - When I write in the terminal using python in VScode i can never write in the terminal like the tutorials are doing. how do I fix that? 如何让我的 vscode 终端将我的 venv 用于 python 而不是系统版本? - How can I get my vscode terminal to use my venv for python rather than the system version? 如何在 MacOS 中获取 VSCode 集成终端以启动正确版本的 Python? - How can I get VSCode integrated terminal in MacOS to launch correct version of Python? 如何使用 Linux 终端中显示的 JSON 数据写入 JSON 文件 - How can i write the JSON data shown in my Linux terminal to a JSON file using Python 如何在 VScode for Python 中将 PowerShell 终端更改为简单的终端? - How can I change a PowerShell terminal to a simple one in VScode for Python? 我如何在没有终端命令的情况下运行 vscode 运行 python - how can i vscode run python without terminal command 如何让VSCode的终端识别python - How to get VSCode's terminal to recognize python 如何使用while循环摆脱空字符串? (Python) - How do I get rid of an empty string with using while loop? (python)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM