【问题标题】:VS Code Python extension prompts me to select an interpreter when one is selectedVS Code Python 扩展在选择一个解释器时提示我选择一个解释器
【发布时间】:2020-11-29 02:01:17
【问题描述】:

我正在尝试调试我的 Django 应用程序,但 VS Code 的 Python 扩展在我点击运行时提示我选择解释器,即使在我在虚拟环境中选择了 Python 可执行文件之后也是如此。

launch.json

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Django",
      "type": "python",
      "request": "launch",
      "program": "${workspaceFolder}/manage.py",
      "args": ["runserver", "localhost:9000", "--noreload"],
      "django": true,
      "console": "externalTerminal"
    }
  ]
}

我可以做些什么来消除这个讨厌的警报,以便我可以开始调试?

【问题讨论】:

    标签: python django visual-studio-code


    【解决方案1】:

    不,你标记的是调试选项,解释器应该是左边的那个:

    您可以通过Python:从命令面板中选择解释器命令(Ctrl+Shift+P)选择现有的python环境;

    或通过在终端中运行命令python -m venv <name> 创建一个虚拟环境。当您创建一个新的虚拟环境时,将显示一个提示,允许您为工作区选择它。选择是:

    更详细的信息,可以参考Python EnvironmentsDjango Tutorial

    【讨论】:

      猜你喜欢
      • 2022-09-26
      • 2022-07-01
      • 2020-04-30
      • 1970-01-01
      • 2022-09-25
      • 2022-01-13
      • 2020-10-12
      • 1970-01-01
      • 2021-08-17
      相关资源
      最近更新 更多