
我在 VS Code 中安裝了 Code Runner 擴充功能。在我的文件中settings.json
,我設定了"python.pythonPath": "python"
選項,並且 python 位於我的 Win10 PATH 變數中。
在settings.json中的選項中code-runner.executorMap
,python由"python": "python.pythonPath"
.但是,當我使用Ctrl+ Alt+運行腳本時,N我得到
'python.pythonPath' is not recognized as an internal or external command,
operable program or batch file.
如果我在code-runner.executorMap
python 選項中設定絕對路徑,就像"C:\\Program Files (x86)\\Python36-32\\python.exe"
我抱怨空格一樣
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
僅採用第一個單詞,直到出現第一個空格為止。如果我使用\
轉義空格,則會出現 JSON 錯誤。
答案1
我找到怎麼做了。簡單,在settings.json中的"code-runner.executorMap"
python選項下放置
"python": "python"
現在它在 Win10 PATH 中搜尋 python 並透過點擊運行圖示或 ctrl-alt-N 來運行。