In terminal (bash) on OSX I can set an environment variable, using the syntax export VARNAME=1
or export VARNAME="hello"
; and that persist as long as the session is running, or until the terminal window is closed.
What would be the equivalent form, to do the same via Python3? I would like to avoid to call Popen
just to set a global variable.
Also I need this variable only for the purpose to run my python code; once the script is done, I do not need it anymore; so even if it last only for the lifespan of my script running, it is acceptable.