You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode运行Python脚本随机出现‘Timed out waiting for debuggee to spawn’错误求助

解决VSCode Python调试随机出现“Timed out waiting for debuggee to spawn”的方案

错误提示:Timed out waiting for debuggee to spawn
错误截图:错误截图
调试器扩展启动器路径:/homes/noyah/.vscode-server/extensions/ms-python.python-2022.19.13251009/pythonFiles/lib/python/debugpy/adapter/../../debugpy/launcher

核心修复步骤

  • 更新Python扩展与VSCode:你的Python扩展版本为2022.19.13251009,属于旧版本,直接在VSCode扩展市场升级Python扩展至最新版,同时将VSCode本身更新到最新稳定版——旧版debugpy存在不少兼容性问题,升级是最有效的解决方式之一。
  • 延长调试超时时间:在项目根目录的.vscode/launch.json中添加timeout参数,延长调试器等待进程启动的时间,示例配置如下:
    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Python: Current File",
                "type": "python",
                "request": "launch",
                "program": "${file}",
                "console": "integratedTerminal",
                "timeout": 30000
            }
        ]
    }
    
  • 确认Python解释器一致性:按下Ctrl+Shift+P(Windows/Linux)或Cmd+Shift+P(Mac),输入Python: Select Interpreter,选择脚本依赖的虚拟环境或系统解释器,避免环境不匹配导致的启动失败。
  • 清理debugpy缓存或重装扩展:删除~/.vscode-server/extensions/ms-python.python-2022.19.13251009/pythonFiles/lib/python/debugpy下的临时缓存文件,或者直接卸载后重新安装Python扩展。
  • 排查冲突扩展:暂时禁用其他非必要扩展(如代码格式化、静态检查类工具),逐一验证是否存在扩展干扰debugpy启动的情况。
  • 检查系统资源限制(Linux服务器环境):使用ulimit -a查看当前进程数、内存等资源限制,若存在资源不足的情况,调整/etc/security/limits.conf中的对应配置。

备选方案

若上述方法无效,可手动指定debugpy路径到launch.json中:

{
    "name": "Python: Current File",
    "type": "python",
    "request": "launch",
    "program": "${file}",
    "console": "integratedTerminal",
    "debugpyPath": "/homes/noyah/.vscode-server/extensions/ms-python.python-2022.19.13251009/pythonFiles/lib/python/debugpy"
}

内容的提问来源于stack exchange,提问作者Noyah

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.05 18:20:43