windows - 为什么 IPython 显示多个字符?
问题描述
我刚刚为 Windows 安装了 IPython,但这一直在发生:
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.16.1 -- An enhanced Interactive Python. Type '?' for help.
In [1]: i = 11
In [2]: iiii
Out[2]: 1
In [3]: iiiiii
Out[3]: 1
In [4]: iiiiiiii
Out[4]: 1
In [5]: Press ENTER to continue...
Unhandled exception in event loop:
File "c:\users\<username>\appdata\local\programs\python\python38-32\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
f.result() # may raise
File "c:\users\<username>\appdata\local\programs\python\python38-32\lib\asyncio\windows_events.py", line 808, in _poll
value = callback(transferred, key, ov)
File "c:\users\<username>\appdata\local\programs\python\python38-32\lib\asyncio\windows_events.py", line 457, in finish_recv
raise ConnectionResetError(*exc.args)
Exception [WinError 995] The I/O operation has been aborted because of either a thread exit or an application request
Press ENTER to continue...
对于In [2]
,In [3]
和In [4]
, 我只按i
了一次。在我按下 ENTER 后,它们的长度也增加了。
错误随机发生,但效果纯图形化,否则效果很好。
另外,当我按退格键时会发生这种情况:
In [1]: a = "bc|cb" = a
(后按退格键|
)
我已经重新安装了 Python,这又发生了。
我使用 pip 安装了 IPython,使用了适用于 Windows 的 IPython 网站上的说明
更令人困惑的是,我的 python shell 安装了 ipython 自动完成功能。
但是,如果我在没有任何东西可以自动完成时按 Tab,则会发生这种情况:
Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:20:19) [MSC v.1925 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> Readline internal error
Traceback (most recent call last):
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyreadline\console\console.py", line 768, in hook_wrapper_23
res = ensure_str(readline_hook(prompt))
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyreadline\rlmain.py", line 571, in readline
self._readline_from_keyboard()
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyreadline\rlmain.py", line 536, in _readline_from_keyboard
if self._readline_from_keyboard_poll():
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyreadline\rlmain.py", line 556, in _readline_from_keyboard_poll
result = self.mode.process_keyevent(event.keyinfo)
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyreadline\modes\emacs.py", line 243, in process_keyevent
r = self.process_keyevent_queue[-1](keyinfo)
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyreadline\modes\emacs.py", line 286, in _process_keyevent
r = dispatch_func(keyinfo)
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyreadline\modes\basemode.py", line 257, in complete
completions = self._get_completions()
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pyreadline\modes\basemode.py", line 200, in _get_completions
r = self.completer(ensure_unicode(text), i)
File "C:\Users\<username>\AppData\Local\Programs\Python\Python38-32\lib\rlcompleter.py", line 80, in complete
readline.redisplay()
AttributeError: module 'readline' has no attribute 'redisplay'
解决方案
我在 PowerShell (5.1.18362.1171) 和命令提示符中对 ipython 7.19.0 和 Python 3.9.0 有同样的问题。这也很奇怪,当我按下删除时,最后输入的字符出现在命令行上。我仍在寻找解释和修复,同时我使用 Jupyter QtConsole 工作正常
jupyter qtconsole
推荐阅读
- python-3.x - BS4:AttributeError:“NoneType”对象没有属性“文本”
- python - pybind11 如何使用 setup.py 添加 C++ 依赖项
- c++ - 将 Boost.Python 与第三方绑定混合使用
- java - 参数化 JMeter HTTP 请求路径
- python - 带有 numpy 索引的错误(?)
- jsx - JSX 条件渲染不根据状态变化更新
- swift - Xcode - 桥接头的 Swift 编译器错误
- cmake - 包含双引号和空格符的编译器选项编译
- mysql - 数据库复制在更新时非常慢
- ruby-on-rails - 如何模拟谷歌oauth的失败?