wxpy 中embed()和jupyter 依赖prompt-toolkit冲突

当我安装pip install notebook (或者pip install jupyter)后pip会自动安装一个叫做prompt-toolkit的包,这个时候再调用wxpy中的embed()函数就会报错

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\prompt_toolkit\eventloop\context.py", line 88, in get
    return self._storage[ctx]
KeyError: 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\prompt_toolkit\output\defaults.py", line 52, in get_default_output
    value = _default_output.get()
  File "C:\Python37\lib\site-packages\prompt_toolkit\eventloop\context.py", line 90, in get
    raise TaskLocalNotSetError
prompt_toolkit.eventloop.context.TaskLocalNotSetError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "L:\数字货币咨询\python_script\宏观指数\tushare_demo.py", line 50, in <module>
    embed()
  File "C:\Python37\lib\site-packages\wxpy\utils\console.py", line 74, in embed
    _shell(local=local, banner=banner)
  File "C:\Python37\lib\site-packages\wxpy\utils\console.py", line 17, in _ipython
    config=load_default_config()
  File "C:\Python37\lib\site-packages\traitlets\config\configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "C:\Python37\lib\site-packages\IPython\terminal\embed.py", line 159, in __init__
    super(InteractiveShellEmbed,self).__init__(**kw)
  File "C:\Python37\lib\site-packages\IPython\terminal\interactiveshell.py", line 460, in __init__
    self.init_prompt_toolkit_cli()
  File "C:\Python37\lib\site-packages\IPython\terminal\interactiveshell.py", line 292, in init_prompt_toolkit_cli
    **self._extra_prompt_options())
  File "C:\Python37\lib\site-packages\prompt_toolkit\shortcuts\prompt.py", line 285, in __init__
    output = output or get_default_output()
  File "C:\Python37\lib\site-packages\prompt_toolkit\output\defaults.py", line 61, in get_default_output
    return create_output()
  File "C:\Python37\lib\site-packages\prompt_toolkit\output\defaults.py", line 35, in create_output
    return Win32Output(stdout)
  File "C:\Python37\lib\site-packages\prompt_toolkit\output\win32.py", line 83, in __init__
    info = self.get_win32_screen_buffer_info()
  File "C:\Python37\lib\site-packages\prompt_toolkit\output\win32.py", line 168, in get_win32_screen_buffer_info
    self.flush()
  File "C:\Python37\lib\site-packages\prompt_toolkit\output\win32.py", line 296, in flush
    self.stdout.flush()
AttributeError: 'NoneType' object has no attribute 'flush'
>>> 
当我pip uninstall prompt-toolkit后就正常了

 

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值