How to set env variable in Jupyter notebook

前端 未结 8 879
时光取名叫无心
时光取名叫无心 2020-11-27 13:05

I\'ve a problem that Jupyter can\'t see env variable in bashrc file, is there a way to load these variables in jupyter or add custome variable to it?

8条回答
  •  醉酒成梦
    2020-11-27 13:31

    If you are using systemd I just found out that you seem to have to add them to the systemd unit file. This on Ubuntu 16. Putting them into the .profile and .bashrc (even the /etc/profile) resulted in the ENV Vars not being available in the juypter notebooks.

    I had to edit:

    /lib/systemd/system/jupyer-notebook.service
    

    and put in the variable i wanted to read in the unit file like:

    Environment=MYOWN_VAR=theVar
    

    and only then could I read it from within juypter notebook.

提交回复
热议问题