簡體   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藍色文本。 我對白色文本沒有問題,但早些時候我的 VScode 沒有顯示這個藍色文本,它把 output 弄亂了,有什么辦法可以擺脫它。 https://i.stack.imgur.com/CUeL4.jpg

目前沒有直接的方法可以在VS Code中省略“Terminal”的路徑信息。 該信息向我們顯示了使用的 python 解釋器的路徑以及執行運行命令時執行文件的路徑。

解決方法:

  1. 請使用“ launch.json ”中的設置: "console": "internalConsole",然后按F5調試代碼,“DEBUG CONSOLE”只會顯示結果。

  2. 您可以使用 VS Code 擴展“Code Runner”並使用“ settings.json ”中的設置: "code-runner.showExecutionMessage": false,然后單擊“Run Code”:

    在此處輸入圖像描述

參考: Python Visual Studio Code 中的調試配置

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM