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

VSCode调试Python时终端出现错误/截断命令问题求助

环境信息
VSCode版本: 1.89.0
Python调试器版本: v2024.6.0  
操作系统: Windows 10
问题描述

在VSCode中使用Python调试器调试时,终端自动粘贴的调试命令始终存在错误:

首次调试的异常输出

首次调试文件时,命令能正常执行,但控制台会输出一段奇怪文本(不影响运行):

USER@LNWG6GMF0 MINGW64 D:/Microsoft VS Code
$  /usr/bin/env d:\Miniconda\envs\coagfloc\python.exe c:\Users\USER\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher 61808 -- D:\Users\USER\Desktop\Flocculatieexperimenten\main.py 
$LAST FOUR CHARACTERS OF MY USERNAME$\\Desktop\\Flocculatieexperimenten\\main.py ;8eb223eb-d552-48b1-90d5-8c7a5710994cBackend QtAgg is interactive backend. Turning interactive mode on.

再次调试的执行失败

在同一控制台再次启动调试时,程序完全无法执行:

USER@LNWG6GMF0 MINGW64 D:/Microsoft VS Code
$ ^C
(base) 
USER@LNWG6GMF0 MINGW64 D:/Microsoft VS Code
$ c\python.exe c:\Users\USER\.vscode\extensions\ms-python.debugpy-2024.6.0-win32-x64\bundled\libs\debugpy\adapter/../..\debugpy\launcher 61822 -- D:\Users\USER\Desktop\Flocculatieexperimenten\main.py
ain.py ;8eb223eb-d552-48b1-90d5-8c7a5710994cbash: c\python.exe: No such file or directory
  • 终端粘贴的命令被错误截断,c\python.exe是Python完整路径的残缺内容
  • CTRL-C为自动触发,并非手动操作
  • VSCode提示程序挂起,但实际上程序从未启动
launch.json配置
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python Debugger: Current file",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }
    ]
}
已尝试的无效操作
  • 重新安装VSCode、Python、Conda及Python调试器扩展
  • 降级安装旧版本的VSCode、调试器扩展
  • 修改launch.json,硬编码Python路径和调试命令

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.24 18:17:40