Visual Studio Code - How to add multiple paths to python path?

前端 未结 7 722
我在风中等你
我在风中等你 2020-12-04 12:40

I am experimenting with Visual Studio Code and so far, it seems great (light, fast, etc).

I am trying to get one of my Python apps running that uses a virtual enviro

7条回答
  •  感情败类
    2020-12-04 12:50

    This worked for me:-

    in your launch.json profile entry, specify a new entry called "env", and set PYTHONPATH yourself.

    "configurations": [
        {
            "name": "Python",
            "type": "python",
            "stopOnEntry": false,
            "request": "launch",
            "pythonPath": "${config.python.pythonPath}",
            "program": "${file}",
            "cwd": "${workspaceRoot}",
            "debugOptions": [
                "WaitOnAbnormalExit",
                "WaitOnNormalExit",
                "RedirectOutput"
            ],
            "env": {
                "PYTHONPATH": "/path/a:path/b"
            }
        }
    ]
    

提交回复
热议问题