关闭浏览器选项卡后,保持Jupyter Notebook运行 [英] Keep Jupyter notebook running after closing browser tab
问题描述
我使用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屋!