本文介绍了如何替换“从IPython.kernel导入KernelManager"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一些代码试图从IPython
导入KernalManager
,但出现警告
I have some code which tries to import a KernalManager
from IPython
, but I get a Warning
/home/alex/Projects/VETests/ipyrunner/local/lib/python2.7/site-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated since IPython 4.0.You should import from ipykernel or jupyter_client instead.
"You should import from ipykernel or jupyter_client instead.", ShimWarning)
但是当我执行以下操作
from ipykernel import KernelManager
我得到一个错误
ImportError: cannot import name KernelManager
如何正确处理?
推荐答案
替换
from IPython.kernel import KernelManager
/from ipykernel import KernelManager
使用
from jupyter_client.manager import KernelManager
.
这篇关于如何替换“从IPython.kernel导入KernelManager"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!