关闭浏览器选项卡后,保持Jupyter Notebook运行 [英] Keep Jupyter notebook running after closing browser tab

查看:621
本文介绍了关闭浏览器选项卡后,保持Jupyter Notebook运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Jupyter Notebook进行一系列需要一些时间的实验. 某些单元格花费太多时间执行,因此正常情况下我想关闭浏览器选项卡,然后稍后再返回.但是,当我执行内核中断时.

I use Jupyter Notebook to run a series of experiments that take some time. Certain cells take way too much time to execute so it's normal that I'd like to close the browser tab and come back later. But when I do the kernel interrupts running.

我想有一个解决方法,但是我找不到

I guess there is a workaround for this but I can't find it

推荐答案

最简单的解决方法似乎是

The simplest workaround to this seems to be the built-in cell magic %%capture:

%%capture output
# Time-consuming code here

保存,关闭标签,稍后再返回.现在,输出存储在output变量中:

Save, close tab, come back later. The output is now stored in the output variable:

output.show()

这将显示所有临时的print结果以及普通或丰富的输出单元格.

This will show all interim print results as well as the plain or rich output cell.

这篇关于关闭浏览器选项卡后,保持Jupyter Notebook运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆