IPython 笔记本 : How to connect to existing kernel?

标签 ipython ipython-notebook

我可以连接两个 ipython console session 到一个内核:

$ ipython console
In [1]: %connect_info  
{
   ... Content of JSON with info for connecting ...
}

Paste the above JSON into a file, and connect with:
    $> ipython <app> --existing <file>
or, if you are local, you can connect with just:
    $> ipython <app> --existing kernel-43204.json
or even just:
    $> ipython <app> --existing
    if this is the most recent IPython session you have started.

因此我可以替换 <app>再次通过控制台
$ ipython console --existing kernel-43204.json

但是,我想与 ipython notebook 共享我的内核,以便我可以可视化我的数据。我尝试并失败了:
$ ipython notebook --existing kernel-43204.json
[C 13:35:01.025 NotebookApp] Unrecognized flag: '--existing'

我如何工作和在 ipython console 之间切换的任何建议和 ipython notebook ?

最佳答案

笔记本没有 UI 或 API 可以做到这一点,为了代码简单,假设笔记本拥有并启动内核。您必须自己编写 KernelManager子类化并配置 IPython 以使用它(+ 编写一些 UI 代码,如果您希望它易于使用),以便您能够选择一个已经存在的内核。

关于IPython 笔记本 : How to connect to existing kernel?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31382405/

相关文章:

python - Python/IPython shell 中的对象字符串表示

vim - 在外部编辑器中编辑IPython单元

python - 如何使用 matplotlib 在同一行中绘制多个图形?

python - 如何在 Python 的 PyPyODBC 模块中使用 FetchAll?

python - 在 Mac OS 上将 iPython 更新到 2.0 版

jupyter-notebook - 每次更新 ipywidgets 时更新显示值

ipython-notebook - iPython Notebook 和 Mathjax 标记方程

python - 为什么ipdb下的help()命令会出错

python - 如何在 IPython/Jupyter 笔记本中自动加载配置文件?

ipython - 将正在运行的 ipython 笔记本与进程匹配