简体   繁体   English

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

[英]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.

相关问题 如何在 Visual Studio Code 中获取 settings.json 的 pylint 部分? - How to get to pylint part of settings.json in Visual Studio Code? Visual Studio Code 正确配置 settings.json - Visual Studio Code configure settings.json correctly 有没有办法参数化 VS Code 的 python.pythonPath 设置? - Is there any way to parameterize VS Code's python.pythonPath setting? 将自定义 python.pythonPath 添加到解释器列表 - Add Custom python.pythonPath to List of Interpreters VSCode Code Runner 不遵循设置。json - VSCode Code Runner not following settings.json 如何在Visual Studio Code中将python或PySpark模块添加或附加到PYTHONPATH - How to add or append python or PySpark modules to PYTHONPATH in Visual Studio Code Visual Studio Code launch.json 设置用于调试 Python 模块 - Visual Studio Code launch.json settings for debugging Python modules 在 git 跟踪的项目中处理 vscode 设置工作区 python.pythonPath - Dealing with vscode setting workspace python.pythonPath in git tracked project VS Code 代码运行器扩展:由于空格,努力将 Python PATH 添加到 settings.json - VS Code Code runner extension: Struggling to add Python PATH to settings.json due to whitespace 在不使用 settings.json 文件的情况下在 VS Code 中设置本地项目的 Python 路径 - Setting the Python path for local project in VS Code without using the settings.json file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM