[Python] How to reload environment variables in Python?

Discussão em 'Python' iniciado por Stack, Janeiro 23, 2025.

  1. Stack

    Stack Membro Participativo

    I set up a systemctl service (Jupyter) as part of a bootstrap for a Hadoop cluster. After bootstrap actions are completed, Hadoop is installed. During that step a number of environment variables are set - and these are vital for my service, Jupyter. Problem is, Jupyter does not know these environment variables, as it is started earlier in the process.

    My question: how can I reload environment variables for my user? At the moment the user is running Jupyter, all env variables are known - I just need them loaded into the Python interpreter.

    This fails inside notebook: os.environ['JAVA_HOME'] but works fine in the interpreter (because JAVA_HOME was defined after Jupyter was started).

    Continue reading...

Compartilhe esta Página