When I run this code in bash: VALUE=BAR python -c 'import os; print(os.environ["VALUE"])' I would expect to see the string "BAR" to be printed. I got KeyError error instead, indicating that the script didn't receive the environment variable. I also tried export VALUE=BAR; python -c 'import os; print(os.environ["VALUE"])' and export VALUE=BAR python -c 'import os; print(os.environ["VALUE"])' but I got the same result. @Philippe Running type python; python -V; VALUE=BAR python -c 'import os; print(os.environ["VALUE"])' results in: python is /usr/local/bin/python Python 3.9.0 Traceback (most recent call last): File "<string>", line 1, in <module> File "C:\Users\Danon\AppData\Local\Programs\Python\Python39\lib\os.py", line 679, in __getitem__ raise KeyError(key) from None KeyError: 'VALUE' PS: Perhaps I should've included that, I use WSL and I added symlink /usr/local/bin/python to point to C:\Program Files\Python\python.exe. Continue reading...