[Python] How do I get or create a launch.json file in Visual Studio Code, when using Python?...

Discussão em 'Python' iniciado por Stack, Março 1, 2025.

  1. Stack

    Stack Membro Participativo

    How do I create a launch.json file when using Python in Visual Studio Code? I've read a lot of answers here on Stack Overflow but they assume menu options that I can't find or don't exist in my environment, or other basic knowledge that I don't have and can't find.

    I've read that if I open the VS folder explorer, I'll see an option to create the launch.json file, but there is no such option there. In the Command Palette there's an option to open launch.json, which presumably would create it if it doesn't already exist, but instead it merely opens settings.json.

    What may be a related issue is the project root. Many answers mention this, but I have no idea where my project root is. AFAI can tell, VS Code offers no intuitive way to set up a Python project, and all I've been able to do is test Python files individually. If I want to debug a Python file that takes parameters, then I have to manually edit sys.argv to populate them, instead of having them in a separate launch.json file.

    I've installed several Python extensions from Jupyter, and I'm trying to follow along with their 12.5 hour long introduction to Python data structures and algorithms. So far, I'm fine with the CS and Python material, but I'm really stuck as far as setting up my environment is concerned

    My underlying goal here is to learn Python using cohesive projects, instead of just single files that I could just as well run from the cmd window. Also learning json would be nice.

    Continue reading...

Compartilhe esta Página