gpt4 book ai didi

python - 如何修复 IPython 的 "ImportError: no module named shell"错误

转载 作者:太空狗 更新时间:2023-10-30 00:30:16 26 4
gpt4 key购买 nike

我看到很多人建议我使用以下代码片段来嵌入 IPython shell 或从例如一个 Django View 。

from IPython.Shell import IPShellEmbed
ipython = IPShellEmbed()
ipython()

但是当我这样做的时候,我得到了

>>> from IPython.Shell import IPShellEmbed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Shell

如何嵌入 IPython 或从现有的 Python 应用启动 IPython 控制台?

最佳答案

解决方案是use the following相反:

import IPython
IPython.embed()

Issue 286IPython github repo 上说明 Shell 模块已经移动并且应该 no longer be used .

关于python - 如何修复 IPython 的 "ImportError: no module named shell"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12852887/

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