Where can I put a startup script in Jupyter?

徘徊边缘 提交于 2019-11-29 08:29:34

问题


I'm looking for a way to put my startup script in Jupyter. In IPython, I put it under the $IPYTHON_DIR/profile_default/startup/.

In Jupyter, it seems that the config file should be $JUPYTER_CONFIG_DIR/jupyter_notebook_config.py. However, I would like to use my startup file, which import a slew of Python libraries at the launch of the kernel.

Where can I put such file in Jupyter?


回答1:


You can get the default startup script folder via this in jupyter notebook:

get_ipython().profile_dir.startup_dir

On my Windows PC, the folder is: C:\Users\myusername\.ipython\profile_default\startup

And do read the README file under the folder.

    Files will be run in lexicographical order, so you can control
the execution order of files with a prefix, e.g.::

    00-first.py
    50-middle.py
    99-last.ipy

So you can put a file named 00-xx.py under the folder.



来源:https://stackoverflow.com/questions/45818538/where-can-i-put-a-startup-script-in-jupyter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!