【问题标题】:Update selected python interpreter from script从脚本更新选定的 python 解释器
【发布时间】:2021-11-29 11:17:25
【问题描述】:

我想从脚本更新 vs 代码中选定的 python 解释器。

我试过了:

  • 工作区中的.vscode/settings.json 允许设置python.defaultInterpreterPath,但它只能工作一次。即使在UI中选择“默认解释器”(例如python 3.8),关闭vs code,将设置更改为3.9,再次打开vscode,vs code会记住3.8。
  • $config_path/User/workspaceStorage/.../state.vscdb 还包含一个键 ms-python.python,它为选定的解释器 autoSelectedWorkspacePythonInterpreter 获取数据 - 但在 vscode 中更改解释器时甚至不会改变(从设置的名称来看,这是有意义的)

vs code 甚至将手动选择的解释器的信息存储在哪里?

任何指针都欢迎如何更改使用的 python 解释器(最好从在 vs 代码之外运行的脚本,但如果这样更容易,我也会编写 vs 代码扩展 :))

【问题讨论】:

    标签: python visual-studio-code vscode-settings vscode-extensions


    【解决方案1】:

    $config_path/User/globalStorage/.../state.vscdb --> ms-python.python.

    【讨论】:

      猜你喜欢
      • 2011-05-29
      • 1970-01-01
      • 1970-01-01
      • 2011-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-10-26
      相关资源
      最近更新 更多