[Python] VS Code Python: Script runs with "Run" but fails with "Debug" when using symlinked...

Discussão em 'Python' iniciado por Stack, Abril 16, 2025.

  1. Stack

    Stack Membro Participativo

    Background:


    I'm facing an issue in VS Code where my Python script runs fine using the "Run" button but fails silently when using "Debug".

    Environment:

    • Windows 10
    • Python 3.10
    • VS Code with Python extension
    • Virtual environment used (Miniconda)
    • Script runs normally with:

    python your_script.py

    What I Found:


    The issue was due to selecting the symlinked python.exe in the Scripts folder of the virtual environment.
    This interpreter works with "Run" but breaks with "Debug".
    When I clicked the "Debug" button, nothing happened. I just saw the icon blink briefly. Switching to the root-level python.exe fixed it.

    Question:


    Why does the Scripts/python.exe work with "Run" but not with "Debug"?
    What internal difference causes this behavior?

    Why symlink?


    I used to create the symlink to ensure compatibility with tools expecting the Scripts/python.exe path, as Conda places python.exe in the root of the environment.

    Continue reading...

Compartilhe esta Página