如何替换“从IPython.kernel导入KernelManager”?

时间:2017-10-03 13:41:10

标签: python ipython jupyter-notebook

我有一些代码尝试从KernalManager导入IPython,但我收到警告

/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

如何正确做到?

1 个答案:

答案 0 :(得分:0)

替换

from IPython.kernel import KernelManager / from ipykernel import KernelManager

from jupyter_client.manager import KernelManager