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

问题描述

昨天,在 Visual Studio Code 自我更新之前(从 1.27.2 到 1.28.2),我可以在激活某个环境并调试脚本后从 anaconda 提示符中打开它。现在,当我尝试调试脚本时,我收到有关超时等待调试器连接的错误。

我已经在另一个线程上遵循了一些建议(Visual Studio Code Python Timeout waiting for debugger connection),如果我使用下面的配置可以让它工作,但它似乎仍然是一个问题,它不会在集成中运行终端了。

这曾经有效,但现在中断:

{
    "name": "Python: Current File (Integrated Terminal)",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "stopOnEntry": true,
    "console": "integratedTerminal"
},

如果我想在调试器控制台中运行,这现在可以工作。

{
    "name": "Python: Debug",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "stopOnEntry": true,
    "console": "none"
},

标签: pythondebuggingvisual-studio-code

解决方案


我遇到了同样的问题,为了解决这个问题,我在文件中添加了以下行settings.json

{
    // to fix 'Timeout waiting for debugger connections'
    "python.terminal.activateEnvironment": false
}

推荐阅读