【发布时间】:2020-12-11 23:34:59
【问题描述】:
在选择“运行代码”(默认热键Ctrl + Alt + N)时,我似乎无法让我的settings.json文件影响在VSCode中如何调用python,我的用户settings.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"
当我期待时(正如我在 settings.json 中设置的 python.pythonPath):
[Running] /usr/bin/python3 -u "path/to/file.py"
为什么我的settings.json 文件密钥python.pythonPath 对我的代码的调用方式没有影响?
除其他重要原因外,当我的代码用 python 3 编写时,我的 python 代码甚至没有运行,因为python 在我的机器上调用 python 2。
VSCode 版本:
Version: 1.47.3
Commit: 91899dcef7b8110878ea59626991a18c8a6a1b3e
Date: 2020-07-23T15:51:39.791Z (1 mo ago)
Electron: 7.3.2
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Linux x64 4.15.0-112-generic
【问题讨论】:
标签: python python-3.x linux visual-studio-code