简体   繁体   English

在pydev(IPython)控制台中嵌入IPython shell

[英]Embed IPython shell within the pydev (IPython) console

When I do: 当我做:

from IPython import embed
embed()

the console shows a strange prompt and the shell is not working properly. 控制台显示一个奇怪的提示,shell无法正常工作。 I know that pydev itself uses IPython but some other shell (like web2py interactive shell) also do that and it won't work. 我知道pydev本身使用的是IPython,但是其他一些shell(比如web2py交互式shell)也会这样做而且它不起作用。

In a console embedding IPython recursively many times works well. 在递归嵌入IPython的控制台中,多次运行良好。

Any idea to get it work? 有任何想法让它工作?

Thanks, Gergely 谢谢,Gergely

It doesn't work because the console in PyDev is not a real tty replacement (which IPython expects to work properly). 它不起作用,因为PyDev中的控制台不是真正的替代品(IPython期望它正常工作)。

So, ideally, if just for using IPython for dev you want to do, you can use the PyDev interactive interpreter: http://pydev.org/manual_adv_interactive_console.html which is properly integrated in PyDev. 因此,理想情况下,如果您只想使用IPython for dev,您可以使用PyDev交互式解释器: http : //pydev.org/manual_adv_interactive_console.html ,它正确地集成在PyDev中。

Embedding another IPython shell within another IPython shell is now supported as of 3.0 - the I upstreamed patches for it last year. 现在支持在另一个IPython shell中嵌入另一个IPython shell,从3.0开始 - 去年我为它添加了补丁。

Specifically you can do the following to your hearts content, from whatever IPython instance you are in, provided the default command shell works: 具体来说,只要默认命令shell工作,您可以从您所在的任何IPython实例中执行以下内容:

from IPython import embed; embed()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM