我可以连接两个 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/