VSCode — how to set working directory for debug

前端 未结 7 1430
耶瑟儿~
耶瑟儿~ 2020-11-27 03:10

I\'m starting to use vscode for Python. I have a simple test program. I want to run it under debug and I need to set the working directory for the run.

How/where d

7条回答
  •  死守一世寂寞
    2020-11-27 03:34

    In some cases, it might be also useful to set the PYTHONPATH along with the workspaceFolder:

    {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal",
        "cwd": "${workspaceFolder}",
        "env": {
            "PYTHONPATH": "${cwd}"
        }
    }
    
    

提交回复
热议问题