我正在寻找一种将我的启动脚本放入 Jupyter 的方法。在 IPython 中,我把它放在 $IPYTHON_DIR/profile_default/startup/
下。
在 Jupyter 中,配置文件似乎应该是 $JUPYTER_CONFIG_DIR/jupyter_notebook_config.py
。但是,我想使用我的启动文件,它会在内核启动时导入大量 Python 库。
我可以把这样的文件放在 Jupyter 的什么地方?
最佳答案
在jupyter notebook中可以通过这个获取默认的启动脚本文件夹:
get_ipython().profile_dir.startup_dir
在我的 Windows PC 上,文件夹是:C:\Users\myusername\.ipython\profile_default\startup
并阅读文件夹下的 README 文件。
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
所以你可以在文件夹下放一个名为00-xx.py
的文件。
关于python - 我可以在 Jupyter 的什么地方放置启动脚本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45818538/