问题
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)
but when I do the following
from ipykernel import KernelManager
I get an error
ImportError: cannot import name KernelManager
How to do it right?
回答1:
Replace
from IPython.kernel import KernelManager
/from ipykernel import KernelManager
with
from jupyter_client.manager import KernelManager
.
来源:https://stackoverflow.com/questions/46546026/how-to-replace-from-ipython-kernel-import-kernelmanager