首页 > 解决方案 > Visual Studio Code Python 超时等待调试器连接

问题描述

我正在使用 Python 运行 Visual Studio 代码教程,但无法连接到调试器。当我搜索时,Google / SO 出现空缺。通常我将 Anaconda 与 Jupyter 一起使用,因此我在激活的 3.6 虚拟环境中将 Visual Studio Code 连接到 python。我尝试在我的虚拟环境中 pip 安装 ptvsd,但这并没有改变我所看到的。

我欢迎任何建议。截图如下。底部屏幕截图中的 launch.json

在此处输入图像描述 在此处输入图像描述

标签: pythondebuggingvisual-studio-code

解决方案


打开launch.json文件并添加以下配置:

{
     "name": "Python: Debug Console",
     "type": "python",
     "request": "launch",
     "program": "${file}",
     "console": "internalConsole"
}

当您为控制台指定时,它将在调试器控制台中运行调试器,而不是在内部或外部终端中运行。none internalConsole


推荐阅读