如何在 Visual Studio 代码中获取 Code Runner 扩展以使用选定的 Python 解释器?

How do you get the Code Runner extension in Visual Studio Code to use the selected Python interpreter?

我想快速 运行 vscode 中使用 Code Runner 扩展名的活动 python 文件。

当我 运行 收到消息时...

Python was not found but can be installed from the Microsoft Store: https://go.microsoft.com/fwlink?linkID=2082640

我希望 Code Runner 使用活动的 vscdode Python 解释器。怎么样?

这花了一些时间才找到,所以我想我会post在这里为未来的搜索者提供问答。

来自 this github post.
打开您的 settings.json 文件并添加此设置。

"code-runner.executorMap": {
  "python":"$pythonPath $fullFileName",
}