Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual Studio代码忽略settings.json字段:python.pythonPath_Python_Python 3.x_Linux_Visual Studio Code - Fatal编程技术网

Visual Studio代码忽略settings.json字段:python.pythonPath

Visual Studio代码忽略settings.json字段:python.pythonPath,python,python-3.x,linux,visual-studio-code,Python,Python 3.x,Linux,Visual Studio Code,当选择“运行代码”(默认热键Ctrl+Alt+N)时,我似乎无法让我的settings.json文件影响python在VSCode中的调用方式,我的用户settings.json如下所示: { "python.pythonPath": "/usr/bin/python3", "editor.suggestSelection": "first", "vsintellicode.modi

当选择“运行代码”(默认热键
Ctrl+Alt+N
)时,我似乎无法让我的
settings.json
文件影响python在VSCode中的调用方式,我的用户
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
):

为什么我的
settings.json
file key
python.pythonPath
对如何调用我的代码没有影响

除其他重要原因外,当我的代码是用Python3编写的时,我的python代码甚至不会在机器上调用Python2

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.pythonPath
设置将从所有3个作用域中删除-用户工作区工作区文件夹。工作区解释器的路径现在将存储在VS代码的持久存储中,而不是settings.json文件中。这就是为什么您的设置对代码执行路径没有影响。您可以使用Python:Select Interpreter命令更改存储在工作区设置中的值,或在Usersettings.json中添加设置:

"python.defaultInterpreterPath":
"python.defaultInterpreterPath":