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

VS Code中Python调试无法启动问题求助

Fix for VS Code Python Debugger Not Launching (Stuck on Blue Progress Bar)

Hey, I’ve dealt with this exact frustrating issue before—when you hit that green run button and nothing happens except a never-ending blue progress bar, it’s so annoying. Let’s go through some practical fixes that got my debugger working again:

  • Complete your launch.json configuration
    The launch.json snippet you shared looks like the default template with just comments, which means it’s missing critical fields the debugger needs. You need to define at least the program (path to your script) and ensure the interpreter path is set correctly. Here’s a working minimal example you can adapt:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Python: Current File",
                "type": "python",
                "request": "launch",
                "program": "${file}", // Runs the currently open Python file
                "console": "integratedTerminal",
                "python": "${command:python.interpreterPath}" // Uses your selected interpreter
            }
        ]
    }
    

    Also, double-check for JSON syntax errors (like missing commas or unclosed quotes)—VS Code will highlight these in the editor, so fix any red underlines before trying again.

  • Confirm your Python interpreter is selected correctly
    A common culprit is VS Code using the wrong Python environment. Click the Python version number in the bottom-left status bar, then pick the correct interpreter (whether it’s a virtual environment for your project or the global one you use). After selecting, restart VS Code to make sure the change sticks.

  • Rule out extension conflicts
    Some third-party extensions can interfere with the Python debugger. Try temporarily disabling all non-Microsoft extensions, then restart VS Code and test the debugger. If it works, re-enable extensions one by one to find which one was causing the conflict.

  • Reset VS Code’s debug cache
    Corrupted cache files can break the debugger. Try these steps:

    • Close all VS Code windows completely
    • Back up your existing launch.json (in the .vscode folder) then delete it
    • Reopen your project, generate a new debug configuration via the "Run and Debug" panel
    • Use the command palette (Ctrl+Shift+P) to run Python: Select Interpreter again, then launch the debugger
  • Update VS Code and the Python extension
    Outdated versions often have known bugs that cause debugger issues. Check for updates in VS Code (Help > Check for Updates) and update the Python extension via the Extensions panel. After updating, restart VS Code and try debugging again.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 03:22:51