[英]Visual Studio Code ignores settings.json field: python.pythonPath
I can't seem to get my settings.json
file to influence how python is invoked in VSCode when selecting "Run Code" (default hot key Ctrl + Alt + N
), my user settings.json
is as follows:选择“运行代码”(默认热键
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",
}
yet when I run my python file, not debug it , it is showing:然而,当我运行我的 python 文件而不是调试它时,它显示:
[Running] python -u "path/to/file.py"
when I am expecting (as I set python.pythonPath
in settings.json
):当我期待时(因为我在
settings.json
设置了python.pythonPath
):
[Running] /usr/bin/python3 -u "path/to/file.py"
Why is my settings.json
file key python.pythonPath
having no effect on how my code is invoked?为什么我的
settings.json
文件密钥python.pythonPath
对我的代码的调用方式没有影响?
Among other important reasons, my python code doesn't even run as python
invokes python 2 on my machine when my code is written in python 3.在其他重要原因,我的Python代码甚至不运行的
python
我的机器上时,我的代码写在Python 3所调用的Python 2。
VSCode version: 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
From vscode-python-DeprecatePythonPath , python.pythonPath
setting is being removed from all 3 scopes - User , workspace , workspace folder .从vscode-python-DeprecatePythonPath 中,
python.pythonPath
设置将从所有 3 个范围中删除 - User , workspace , workspace folder 。 The path to the workspace interpreter will now be stored in VS Code's persistent storage instead of the settings.json file.工作区解释器的路径现在将存储在 VS Code 的持久存储中,而不是 settings.json 文件中。 That's why your setting has no effect on code execution path.
这就是为什么您的设置对代码执行路径没有影响的原因。 You can change the value stored in workspace settings using Python: Select Interpreter command, or add the setting in User settings.json:
您可以使用Python更改存储在工作区设置中的值:选择解释器命令,或在User settings.json 中添加设置:
"python.defaultInterpreterPath":
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.