import os
os.environ['my_variable'] = 'hello world'
you are able to edit the environment variable while the python process is running but as soon as the python process is terminated, the environment variable changes do not persist. most work-arounds i have found require an extra step with setting a bash command, alias, or updating .bashrc or .profile but is there a way to do this inside of the python process itself?
there are duplicates of this question of course: Why can't environmental variables set in python persist? but i was hoping there may be new solutions to this problem. thank you
$printenv
import os
os.environ['my_variable'] = 'hello world'
running $printenv command again does not show any changes to env variables