簡體   English   中英

vscode“在不調試的情況下運行”不打開 Python 調試控制台

[英]vscode "Run Without Debugging" doesn't open Python Debug Console

VSCode 的“無需調試即可運行”運行 python 文件(我可以從時間過去看出),但它沒有打開任何面板/終端來顯示 output。

我已經卸載/重新安裝了 Microsoft python 擴展,並在退出/重新打開 VSCode 后,在帶有單個“test.py”文件的全新目錄中,在任何工作區之外運行上述實驗。

如何讓 VSCode 在“運行而不調試”時打開“Python 調試控制台”?

您可以手動在setting.json中設置pythonpath的內容。

"python.pythonpPath":"the location of your python.exe" #Note that python.EXE is used here. If you use conda environment, the default configuration may be set to pythonw.exe

我找到了另一種可能的解決方案。

您可以通過添加以下代碼在setting.json中指定shell:

"terminal.integrated.shell.windows":"C:\\WINDOWS\\system32\\cmd.exe",

當然,這種方法已經過時了,我們也會收到警告(但不會影響其有效性):

在此處輸入圖像描述

根據文檔的更新,我們可以通過以下方式命名終端並指定默認終端:

    {
  "terminal.integrated.profiles.windows": {
    "My PowerShell": {
      "path": "pwsh.exe",
      "args": [
         "-noexit",
         "-file",
         "${env:APPDATA}\PowerShell\my-init-script.ps1"
      ]
    }
  },
  "terminal.integrated.defaultProfile.windows": "My PowerShell"
}

在菜單欄的頂部有一個名為“終端”的選項卡單擊它,然后點擊新終端

暫無
暫無

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

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