python - 如何在 IPython (Jupyter) Notebook 中的远程机器上添加内核?

标签 python ipython ipython-notebook ipython-parallel jupyter

本地计算机 (PC) 上 UI 右上角的下拉菜单:

Kernel-> 
    Change kernel->
        Python 2 (on a local PC)
        Python 3 (on a local PC)
        My new kernel (on a remote PC)

最佳答案

IPython notebook 通过预定义的端口与内核对话。要与远程内核通信,您只需将端口转发到远程计算机作为内核初始化的一部分,笔记本不关心内核在哪里,只要它可以与它通信。

您可以设置一个在内核规范文件 (https://ipython.org/ipython-doc/dev/development/kernels.html#kernel-specs) 中调用的包装脚本,或者使用可以帮助您设置和管理不同类型的远程内核的模块:(pip install remote_ikernel;https://bitbucket.org/tdaff/remote_ikernel)。

如果您使用的是 remote_ikernel,并且对机器有 ssh 访问权限,则以下命令将在下拉列表中设置条目:

remote_ikernel manage --add \
    --kernel_cmd="ipython kernel -f {connection_file}" \
    --name="Remote Python" --interface=ssh \
    --host=my_remote_machine

关于python - 如何在 IPython (Jupyter) Notebook 中的远程机器上添加内核?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29037211/

相关文章:

python - 当我使用 urllib2 时回溯,收到 HTTP 500 错误

python - 无法从 read_csv 索引 Pandas 数据框中的日期

python - 精确在线 API : deleting and updating items like BankEntryLines

python - 双击打开一个 ipython 笔记本

python - 线程化 IPython 笔记本的每单元格输出

python - 如何通过 MIMEMultipart 发送电子邮件正文部分

hadoop - CentOS 7 上的 Spark 和 IPython

python - BeautifulSoup 成功写入 html 但 find_all 什么也没返回

python - spyder 中的 IPython 控制台在 Anaconda 中极其缓慢

ipython-notebook - iPython 笔记本错误 - 笔记本 JSON 无效 : u'execution_count' is a required property