ipython 控制台 "Exception [WinError 995] The I/O operation has been aborted" 出错

Error in ipython console "Exception [WinError 995] The I/O operation has been aborted"

我已经在 Windows 10 机器上通过 Anaconda 安装程序安装了 python 3.8.5 和 ipython 7.19.0,当我在 Ipython 中收到以下错误时我导入 keras,然后导入 运行 ls 或任何其他命令。 当我导入其他命令或 运行 其他命令时会发生这种情况。有人可以提出任何解决方案吗?这与最新的 python 或 Ipython 有关吗?或者别的。

C:\Users\AA>ipython
Python 3.8.5 (default, Sep  3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from keras.models import load_model
2021-01-06 10:36:43.729592: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll

In [2]: ls

Unhandled exception in event loop:
  File "C:\ProgramData\Anaconda3\lib\asyncio\proactor_events.py", line 768, in _loop_self_reading
    f.result()  # may raise
  File "C:\ProgramData\Anaconda3\lib\asyncio\windows_events.py", line 808, in _poll
    value = callback(transferred, key, ov)
  File "C:\ProgramData\Anaconda3\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...

这似乎是 ipython 提示工具包(版本 >= 3)中的错误

尝试为您的环境执行此操作:

conda install prompt-toolkit~=2.0

通常我们可以通过执行以下操作来解决此问题:

py -m pip install -U prompt-toolkit~=2.0

如果这似乎不起作用,请在此处对错误进行广泛讨论以及其他一些解决方案:https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1023#issue-534396318

(本期讨论:https://github.com/jquast/blessed/issues/121

根据这个问题:https://github.com/prompt-toolkit/python-prompt-toolkit/issues/1023

将 python 至少升级到 3.8.7 应该可以解决这个问题。