Use environment variables in VSCode

Viewed 6363

This question is related to this question about conda, and it is pretty straightforward:

How can I use an external environment variable inside launch.json?

For instance, selecting the python executable inside my home with $HOME, or the executable:

    {
        "name": "Python: From Home",
        "type": "python",
        "request": "launch",
        "program": "$HOME/Documents/a.py", // nor does "${HOME}" work
        "console": "internalConsole",
        "cwd": "${workspaceFolder}"
    }

or

    {
        "name": "Python: With Anaconda",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "internalConsole",
        "python": "${HOME}/anaconda3/bin/python3",
        "cwd": "${workspaceFolder}"
    }

This would simplify sharing launch.json with coworkers.

1 Answers
Related