在Python shell中使用IPython,例如`code.interact()`. [英] Using IPython from the Python shell like `code.interact()`

查看:59
本文介绍了在Python shell中使用IPython,例如`code.interact()`.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将现有Python外壳中的IPython外壳用作shell-inside-a-shell,类似于内置的code.interact()?

Is it possible to use the IPython shell from an existing Python shell, as a shell-inside-a-shell, similarly to the built-in code.interact()?

推荐答案

推荐的嵌入IPython的方式工作正常:

~ $ python
Python 2.7 [...]
>>> from IPython.Shell import IPShellEmbed
>>> ipshell = IPShellEmbed()
>>> ipshell()

In [1]: 

这篇关于在Python shell中使用IPython,例如`code.interact()`.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆