在IPython 7.0.1中打破了多行编辑 [英] Multi-line editing broken in IPython 7.0.1

查看:91
本文介绍了在IPython 7.0.1中打破了多行编辑的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在zsh shell中使用IPython并且我在定义具有多行的函数时遇到了麻烦。

I'm using IPython in zsh shell and I'm having a trouble defining a function with multiple lines.

例如,在原始的Python shell中,我可以定义如下函数:

For example, in the original Python shell, I can define a function f like this:

>>> def f(x):
...     a = x + 1
...     return a
... 
>>>

当我在IPython中完成时,当'a = x + 1'行时,定义立即结束结束。它看起来像这样:

When I did it in IPython, the defination ends immediately when The line 'a = x + 1' ends. It looks like this:

In [4]: def f(x): 
   ...:     a = x + 1                                                                                                                              

In [5]:   

我该如何修复它通过更改某些配置或安装另一个版本的IPython?

How can I fix it by changing some configuration or installing another version of IPython?

我的Python和IPython版本:

My version of Python and IPython:

Python 3.5.6 |Anaconda, Inc.|  
Type 'copyright', 'credits' or 'license' for more information
IPython 7.0.1 -- An enhanced Interactive Python. Type '?' for help.


推荐答案

这是已知错误(另请参阅这个)。

从我引用的问题中可以清楚地看出,这不是Anaconda发行版的错误,而是进入了IPython的7.0版本。

As it's clear from the issues I've referenced, it's not a bug with the Anaconda distribution but something that slipped into the 7.0 release of IPython.

Matthias Bussonier 建议使用 Co (即Control o)作为止损措施。 Co 在当前行下方打开新的空白行,您可以使用箭头键进行访问和编辑 - 这不是一个非常令人满意的解决方案,但目前没有其他解决方案(除了,当然,将IPython降级到6.x)。

Matthias Bussonier suggested to use C-o (that is Control o) as a stop gap measure. C-o opens new blank lines below the current line that you can reach and edit using the arrow keys — it's not a very satisfactory solution but for now there is no other solution (except, of course, downgrading IPython to 6.x).

结束,使用 Co 打开新行并等待修复或降级到IPython 6.x的错误。

Concluding, use C-o to open new lines and wait for a bug fix or downgrade to IPython 6.x.

其他信息

Carlos Cordoba ,Spyder维护者之一,评论 我的答案说, qtconsole 也会受到此错误的影响......

Carlos Cordoba, one of the Spyder maintainers, in a comment to an answer of mine says that also the qtconsole is affected by this bug...

此外,在IPython 7.1 shell中修复的错误仍存在于 qtconsole 和st的相同版本中op-gap measure我提到过( Ctrl-o 打开当前一行以下的一行)在 qtconsole

Moreover the bug, fixed in the IPython 7.1 shell, is still present in the same version of qtconsole and the stop-gap measure I've mentioned (Ctrl-o to open a line below the current one) does not work in qtconsole.

这篇关于在IPython 7.0.1中打破了多行编辑的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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