【问题标题】:Where can I put a startup script in Jupyter?我在哪里可以在 Jupyter 中放置启动脚本?
【发布时间】:2017-08-22 13:06:43
【问题描述】:

我正在寻找一种将我的启动脚本放入 Jupyter 的方法。在 IPython 中,我把它放在$IPYTHON_DIR/profile_default/startup/ 下。

在 Jupyter 中,配置文件似乎应该是 $JUPYTER_CONFIG_DIR/jupyter_notebook_config.py。但是,我想使用我的启动文件,它会在内核启动时导入大量 Python 库。

在 Jupyter 中我可以将此类文件放在哪里?

【问题讨论】:

    标签: python jupyter-notebook startup


    【解决方案1】:

    在 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的文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-11-27
      • 2011-04-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-30
      • 2017-12-20
      相关资源
      最近更新 更多