Firefox中的IPython Notebook中是否有相当于CTRL + C来破坏正在运行的单元格? [英] Is there an equivalent to CTRL+C in IPython Notebook in Firefox to break cells that are running?

查看:114
本文介绍了Firefox中的IPython Notebook中是否有相当于CTRL + C来破坏正在运行的单元格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始使用IPython笔记本了,我很享受。有时,我会编写需要大量内存或无限循环的错误代码。我发现中断内核选项缓慢或不可靠,有时我必须重新启动内核,丢失内存中的所有内容。

I've started to use the IPython Notebook and am enjoying it. Sometimes, I write buggy code that takes massive memory requirements or has an infinite loop. I find the "interrupt kernel" option sluggish or unreliable, and sometimes I have to restart the kernel, losing everything in memory.

我有时会编写导致OS X的脚本耗尽内存,我必须重新启动。我不是百分百肯定,但是当我之前写过这样的错误并在终端中运行Python时,我通常可以 CTRL + C 我的脚本。

I also sometimes write scripts that cause OS X to run out of memory, and I have to do a hard reboot. I'm not 100% sure, but when I've written bugs like this before and ran Python in the terminal, I can usually CTRL+C my scripts.

我在Mac OS X上使用带有Firefox的Anyonda分发的IPython笔记本。

I am using the Anaconda distribution of IPython notebook with Firefox on Mac OS X.

推荐答案

我可能错了,但我很确定中断内核按钮只是向你当前正在运行的代码发送一个SIGINT信号(这个想法得到了Fernando评论的支持这里),这与击中CTRL + C会做同样的事情。 python中的某些进程比其他进程更突然地处理SIGINT。

I could be wrong, but I'm pretty sure that the "interrupt kernel" button just sends a SIGINT signal to the code that you're currently running (this idea is supported by Fernando's comment here), which is the same thing that hitting CTRL+C would do. Some processes within python handle SIGINTs more abruptly than others.

如果您迫切需要停止在iPython Notebook中运行的某些内容并从终端启动iPython Notebook,您可以在该终端中按两次CTRL + C来中断整个iPython Notebook服务器。这将完全停止iPython Notebook,这意味着无法重新启动或保存您的工作,因此这显然不是一个很好的解决方案(您需要按两次CTRL + C,因为它是一个安全功能,所以人们不会这是偶然的)。但是,在紧急情况下,它通常比中断内核按钮更快地杀死进程。

If you desperately need to stop something that is running in iPython Notebook and you started iPython Notebook from a terminal, you can hit CTRL+C twice in that terminal to interrupt the entire iPython Notebook server. This will stop iPython Notebook alltogether, which means it won't be possible to restart or save your work, so this is obviously not a great solution (you need to hit CTRL+C twice because it's a safety feature so that people don't do it by accident). In case of emergency, however, it generally kills the process more quickly than the "interrupt kernel" button.

这篇关于Firefox中的IPython Notebook中是否有相当于CTRL + C来破坏正在运行的单元格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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