重置ipython内核 [英] Reset ipython kernel

查看:245
本文介绍了重置ipython内核的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道是否有办法重新启动ipython内核而不关闭它,就像笔记本中存在的内核重启功能一样。我尝试了%reset 但这似乎没有清除导入。

I was wondering if there is a way to restart the ipython kernel without closing it, like the kernel restart function that exists in the notebook. I tried %reset but that doesn't seem to clear the imports.

推荐答案

即使如果%reset 清除命名空间和导入的缓存(如在笔记本中),它也会很方便,可以使用显式重新加载以前导入的模块python3.4中的 importlib.reload 或python3.0-3.3中的 imp.reload (如果需要,重置内核在第二步)。

Even though it would be handy if %reset would clear the namespace and the cache for the imports (as in the notebook) one can explicitly reload a previously imported module using importlib.reload in python3.4 or imp.reload in python3.0-3.3 (and if needed reset the kernel in a second step).

这篇关于重置ipython内核的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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