當選擇“運行代碼”(默認熱鍵)時,我似乎無法讓我的settings.json文件影響 python 在 VSCode 中的調用方式,我的用戶如下:Ctrl + Alt + Nsettings.json{ "python.pythonPath": "/usr/bin/python3", "editor.suggestSelection": "first", "vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue", "python.jediEnabled": true, "editor.minimap.enabled": true, "editor.multiCursorModifier": "ctrlCmd", "workbench.tree.indent": 24, "workbench.startupEditor": "untitled", "workbench.settings.editor": "json", "workbench.settings.openDefaultKeybindings": false, "workbench.settings.openDefaultSettings": true, "workbench.settings.useSplitJSON": false, "explorer.confirmDragAndDrop": false, "python.linting.enabled": true, "python.languageServer": "Jedi",}然而,當我運行我的 python 文件而不是調試它時,它顯示:[Running] python -u "path/to/file.py"當我期待時(正如我設定的那樣python.pythonPath)settings.json:[Running] /usr/bin/python3 -u "path/to/file.py"為什么我的settings.json文件密鑰python.pythonPath對我的代碼的調用方式沒有影響?python在其他重要原因中,當我的代碼是用 python 3 編寫時,我的python 代碼甚至沒有在我的機器上運行,因為調用 python 2。VS代碼版本:Version: 1.47.3Commit: 91899dcef7b8110878ea59626991a18c8a6a1b3eDate: 2020-07-23T15:51:39.791Z (1 mo ago)Electron: 7.3.2Chrome: 78.0.3904.130Node.js: 12.8.1V8: 7.8.279.23-electron.0OS: Linux x64 4.15.0-112-generic
1 回答

胡子哥哥
TA貢獻1825條經驗 獲得超6個贊
從vscode-python-DeprecatePythonPath中,python.pythonPath
正在從所有 3 個范圍中刪除設置 -?User、workspace、workspace folder。工作區解釋器的路徑現在將存儲在 VS Code 的持久存儲中,而不是 settings.json 文件中。這就是為什么您的設置對代碼執行路徑沒有影響。您可以使用 Python 更改存儲在工作區設置中的值:選擇解釋器命令,或在用戶settings.json中添加設置:
"python.defaultInterpreterPath":
添加回答
舉報
0/150
提交
取消