是否可以使用现有Python shell中的IPython shell作为shell-inside-a-shell,类似于内置的code.interact()
?
答案 0 :(得分:19)
在 IPython 0.11 中,API已经过大修,shell更容易调用:
import IPython
IPython.embed()
答案 1 :(得分:3)
嵌入IPython的recommended way工作正常:
~ $ python
Python 2.7 [...]
>>> from IPython.Shell import IPShellEmbed
>>> ipshell = IPShellEmbed()
>>> ipshell()
In [1]:
答案 2 :(得分:1)
Django manage.py shell
在可能的情况下调用IPython shell,它的实现如下:
import IPython
shell = IPython.Shell.IPShell()
shell.mainloop()