[英]How can I fix “ImportError: no module named shell” error for IPython
I've seen a number of people recommend that I use the following snippet to embed an IPython shell or drop to an IPython shell from eg a django view. 我见过很多人建议我使用下面的代码片段来嵌入一个IPython shell或从django视图中删除到一个IPython shell。
from IPython.Shell import IPShellEmbed
ipython = IPShellEmbed()
ipython()
But when I do this, I get 但是当我这样做时,我得到了
>>> from IPython.Shell import IPShellEmbed
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Shell
How can I embed IPython or start an IPython console from an existing python app? 如何从现有的python应用程序嵌入IPython或启动IPython控制台?
The solution is to use the following instead: 解决方案是使用以下代码 :
import IPython
IPython.embed()
Issue 286 on the IPython github repo explains that the Shell module has moved and should no longer be used . IPython github repo上的问题286解释了Shell模块已移动,不应再使用 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.