Ipython Exception name ‘sys‘ is not defined报错问题

问题概述

使用Ipython时,通过Tab键索引包名之类的提示报错,错误详情:

Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.


Unhandled exception in event loop:
  File "e:\python3_7\lib\site-packages\prompt_toolkit\eventloop\coroutine.py", line 92, in step_next
    new_f = coroutine.throw(exc)
  File "e:\python3_7\lib\site-packages\prompt_toolkit\buffer.py", line 1654, in new_coroutine
    yield From(coroutine(*a, **kw))
  File "e:\python3_7\lib\site-packages\prompt_toolkit\eventloop\coroutine.py", line 92, in step_next
    new_f = coroutine.throw(exc)
  File "e:\python3_7\lib\site-packages\prompt_toolkit\buffer.py", line 1506, in async_completer
    cancel=lambda: not proceed()))
  File "e:\python3_7\lib\site-packages\prompt_toolkit\eventloop\coroutine.py", line 88, in step_next
    new_f = coroutine.send(None)
  File "e:\python3_7\lib\site-packages\prompt_toolkit\eventloop\async_generator.py", line 117, in consume_async_generator
    item = iterator.send(send)
  File "e:\python3_7\lib\site-packages\prompt_toolkit\completion\base.py", line 176, in get_completions_async
    for item in self.get_completions(document, complete_event):
  File "e:\python3_7\lib\site-packages\IPython\terminal\ptutils.py", line 116, in get_completions
    exc_type, exc_value, exc_tb = sys.exc_info()

Exception name 'sys' is not defined
Press ENTER to continue...

环境

  • Python == 3.8
  • IPython == 7.19.0
  • jedi == 0.18.0

问题详情

以导入docker包为例,正常情况下IPython具备Tab键备选补全代码功能
在这里插入图片描述

但在上述环境中发现只要使用Tab键补全就会触发IPython崩溃问题。网上搜索了好久才找到解决方法,这里做个总结:

方法1

降低IPython版本到7.1.1(含以下)

pip install --upgrade ipython==7.1.1

在这里插入图片描述

方法2

降低jedi版本

pip3 install --upgrade 'jedi<0.18.0'

在这里插入图片描述

引用: https://github.com/ipython/ipython/issues/12745

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值