如何从 Jupyter 4.x 获取 IPython 配置文件行为?
How do I get IPython profile behavior from Jupyter 4.x?
官方(?)推荐运行设置IPython笔记本服务器,并通过
创建配置文件
$ ipython profile create nbserver
按照 http://ipython.org/ipython-doc/1/interactive/public_server.html 中的建议。当通过 ipython notebook
和 ipython notebook --profile=nbserver
.
启动 IPython Notebook 时,这允许非常不同且非常有用的行为
Jupyter 4.0 发生了变化,不再有配置文件。我发现对话 https://gitter.im/ipython/ipython/archives/2015/05/29 中有用户 minrk 说:
The .ipython directory has several things in it:
multiple config directories (called profiles)
one 'data' directory, containing things like kernelspecs, nbextensions
runtime info scattered throughout, but mostly in profiles
Jupyter follows more platform-appropriate conventions:
one config dir at JUPYTER_CONFIG_DIR, default: .jupyter
one data dir at JUPYTER_DATA_DIR, default: platform-specific
one runtime dir at JUPYTER_RUNTIME_DIR, default: platform-specific
还有一个相当神秘的评论:
If you want to use different config, specify a different config directory with JUPYTER_CONFIG_DIR=whatever
获得不同行为的最佳方式是什么(例如,在 运行宁作为服务器与正常使用之间)?
它会涉及 运行宁这样的事情吗:
$ export JUPYTER_CONFIG_DIR=~/.jupyter-nbserver
$ jupyter notebook
每当服务器 'profile' 需要 运行 时?和
$ export JUPYTER_CONFIG_DIR=~/.jupyter
$ jupyter notebook
何时 'normal' 配置文件需要 运行?因为那看起来很可怕。在 Jupyter 4.0 中执行此操作的最佳方法是什么?
使用此博客 post http://www.svds.com/jupyter-notebook-best-practices-for-data-science/ 中的一些代码并对其进行更新。最简单的解决方案似乎是创建一个别名,例如:
alias jupyter-nbserver='JUPYTER_CONFIG_DIR=~/.jupyter-nbserver jupyter notebook'
现在您可以通过简单的命令 jupyter-nbserver
运行 具有不同配置的 jupyter notebook。
一个更强大的解决方案可能涉及创建一个 bash 函数来更改环境变量,检查是否有配置文件,如果没有创建一个,然后执行,但这可能有点矫枉过正。我对这个相关问题 给出的答案是为新 'profile'.
创建初始配置文件
官方(?)推荐运行设置IPython笔记本服务器,并通过
创建配置文件$ ipython profile create nbserver
按照 http://ipython.org/ipython-doc/1/interactive/public_server.html 中的建议。当通过 ipython notebook
和 ipython notebook --profile=nbserver
.
Jupyter 4.0 发生了变化,不再有配置文件。我发现对话 https://gitter.im/ipython/ipython/archives/2015/05/29 中有用户 minrk 说:
The .ipython directory has several things in it:
multiple config directories (called profiles)
one 'data' directory, containing things like kernelspecs, nbextensions
runtime info scattered throughout, but mostly in profiles
Jupyter follows more platform-appropriate conventions:
one config dir at JUPYTER_CONFIG_DIR, default: .jupyter
one data dir at JUPYTER_DATA_DIR, default: platform-specific
one runtime dir at JUPYTER_RUNTIME_DIR, default: platform-specific
还有一个相当神秘的评论:
If you want to use different config, specify a different config directory with JUPYTER_CONFIG_DIR=whatever
获得不同行为的最佳方式是什么(例如,在 运行宁作为服务器与正常使用之间)?
它会涉及 运行宁这样的事情吗:
$ export JUPYTER_CONFIG_DIR=~/.jupyter-nbserver
$ jupyter notebook
每当服务器 'profile' 需要 运行 时?和
$ export JUPYTER_CONFIG_DIR=~/.jupyter
$ jupyter notebook
何时 'normal' 配置文件需要 运行?因为那看起来很可怕。在 Jupyter 4.0 中执行此操作的最佳方法是什么?
使用此博客 post http://www.svds.com/jupyter-notebook-best-practices-for-data-science/ 中的一些代码并对其进行更新。最简单的解决方案似乎是创建一个别名,例如:
alias jupyter-nbserver='JUPYTER_CONFIG_DIR=~/.jupyter-nbserver jupyter notebook'
现在您可以通过简单的命令 jupyter-nbserver
运行 具有不同配置的 jupyter notebook。
一个更强大的解决方案可能涉及创建一个 bash 函数来更改环境变量,检查是否有配置文件,如果没有创建一个,然后执行,但这可能有点矫枉过正。我对这个相关问题 给出的答案是为新 'profile'.
创建初始配置文件