如何解决Visual Studio代码将忽略settings.json字段:python.pythonPath
选择“运行代码”(默认热键settings.json
)时,我似乎无法获得Ctrl + Alt + N
文件来影响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"
我期望的时间(因为我在python.pythonPath
中设置了settings.json
):
[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
解决方法
从vscode-python-DeprecatePythonPath的CanvasOutput
设置已从所有3个范围中删除-用户,工作区,工作区文件夹。现在,工作区解释器的路径将存储在VS Code的永久存储中,而不是settings.json文件中。这就是为什么您的设置对代码执行路径没有影响的原因。您可以使用 Python:选择Interpreter 命令更改存储在工作区设置中的值,或在 User settings.json:
python.pythonPath
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。