gpt4 book ai didi

python - 如何替换 "from IPython.kernel import KernelManager"?

转载 作者:行者123 更新时间:2023-12-05 05:19:18 32 4
gpt4 key购买 nike

我有一些代码试图从 IPython 导入一个 KernalManager,但是我得到了一个警告

/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

从 jupyter_client.manager 导入 KernelManager

关于python - 如何替换 "from IPython.kernel import KernelManager"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46546026/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com