簡體   English   中英

VSCode Remote SSH:在新終端中運行 Python 文件

[英]VSCode Remote SSH: Run Python File in New Terminal

我正在為 VSCode 使用遠程 SSH 擴展。 Whenever I try to run a Python file in the Python terminal using the Run Python File in Terminal command, while the terminal is already executing another python program, VSCode tries to execute the new program in the same Python terminal, instead of opening a new terminal . 有沒有辦法在新終端中執行每個 python 程序,以便多個程序可以同時運行?

編輯:試圖顯式打開一個新的 Python 終端,但是, Run Python File in Terminal始終路由到第一個終端。 如果我通過鍵入python my_prog.py在新終端中顯式運行 Python 程序,它可以工作,但我正在尋找一種交互式方式。

在VS Code中,“Run Python File in Terminal”命令默認在一個“默認”“終端”中執行,這樣可以避免運行時混淆的影響,減少運行時查找python和文件路徑的時間。

如果需要同步,VS Code 目前不支持同時運行兩個或多個終端。 可以參考這個鏈接: VSCode可以同時在兩個或多個終端自動運行python腳本嗎?

如果不需要同步,只需要每次代碼執行在一個新的獨立終端,可以在“launch.json”中設置: "console": "externalTerminal",

然后點擊F5調試代碼:

在此處輸入圖像描述

暫無
暫無

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

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