VSCode: Set environment variables via script

Viewed 6895

I have a shell script env.sh containing statements like export ENV_VAR1 = 1. On Linux terminal, I can use . env.sh or source env.sh to set the environment variables.

How to set the environment variables in Visual Studio Code (VSCode) via env.sh?

I have tried multiple approaches:

1) I start (VSCode - /usr/share/code/code) after sourcing the script as follows

. env.sh /usr/share/code/code

2) I used the extension "Auto Run Command" to call . env.sh at workspace loading time.

But these do not work. For example, while using the Jupyter extension, I get errors in import matplotlib even though the import works when I use the Python interpreter inside the Linux terminal above.

2 Answers
Related