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

如何解决Visual Studio Code中Python调试器崩溃及调试栏缺失问题?

Fixing Two Common Python Debugging Issues in VS Code

Got it, let's break down solutions for both of your VS Code Python debugging problems—these are pretty typical hiccups, so we'll get you sorted out quickly.


1. Fixing Python Debugger Crashes

If the Python Debugger keeps crashing mid-debug, try these steps in order:

  • Update the Python Extension & Debugger
    Outdated versions often have known bugs. Open the Extensions panel (Ctrl+Shift+X), find the Python extension by Microsoft, click "Update" if available, then restart VS Code. This alone fixes most crash issues.

  • Verify Your Python Interpreter
    Make sure VS Code is using a valid, non-corrupted Python environment. Press Ctrl+Shift+P, run Python: Select Interpreter, and pick the correct one (e.g., your project's virtual environment or a system Python that works for your code).

  • Simplify Your Debug Configuration
    Overly complex launch.json settings can cause crashes. Reset to the default config: Open the Debug panel, click "create a launch.json file", select "Python", then choose the "Python File" template. Try debugging with this basic setup—if it works, you can tweak the config later.

  • Disable Conflicting Extensions
    Other VS Code extensions might clash with the Python debugger. Temporarily disable all extensions except the Python one, then test debugging. If it stops crashing, re-enable extensions one by one to find the culprit.

  • Repair Your Python Environment
    A corrupted virtual environment or conflicting dependencies can break the debugger. Create a fresh virtual environment with python -m venv venv, activate it, reinstall your project dependencies with pip install -r requirements.txt, then try debugging again.


2. Getting the Debug Panel to Show Up (Instead of Just Code Output)

If launching debug only shows code output and no debug controls, here's what to do:

  • Make Sure You're Actually Starting Debug Mode
    This is a super common mistake! Don't click the "Run Python File" button (top-right play icon)—that runs your code normally, not in debug mode. Instead, press F5 or open the Debug panel (left-side bug icon) and click the green "Start Debugging" button.

  • Check Your launch.json Configuration
    Open your launch.json file and ensure the request field is set to "launch" (not "attach"—attach is for connecting to an already running process, which won't show the debug panel for a new run). If you don't have a launch.json, create one using the default template as mentioned earlier.

  • Reset VS Code's View Layout
    Sometimes the debug panel gets hidden accidentally. Press Ctrl+Shift+P, run View: Reset View Layout, then restart debugging. This will restore VS Code's default panel positions.

  • Adjust Debug Panel Settings
    Go to VS Code's Settings (Ctrl+,), search for Debug: Show Panel, and set it to "always" or "onDebug" (this ensures the panel pops up whenever you start debugging). Also, check that Debug: Inline Values is enabled if you want variable previews in the editor.

  • Restart VS Code
    Occasional glitches in VS Code's cache can hide the debug panel. A quick restart often fixes this without needing further tweaks.


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.21 08:35:30