带有 Python 3.8 的 Jupyter Notebook - NotImplementedError [英] Jupyter Notebook with Python 3.8 - NotImplementedError
问题描述
最近升级到 Python 3.8,并安装了 jupyter
.但是,当尝试运行 jupyter notebook
时出现以下错误:
Upgraded recently to Python 3.8, and installed jupyter
. However, when trying to run jupyter notebook
getting the following error:
File "c:usersuserappdatalocalprogramspythonpython38libsite-packages ornadoplatformasyncio.py", line 99, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "c:usersuserappdatalocalprogramspythonpython38libasyncioevents.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
我知道 Windows 上的 Python 3.8 默认切换到 ProactorEventLoop
,所以我怀疑它与此有关.
I know Python 3.8 on windows switched to ProactorEventLoop
by default, so I suspect it is related to this.
Jupyter 目前不支持 Python 3.8?有解决办法吗?
Jupyter does not support Python 3.8 at the moment? Is there a work around?
推荐答案
EDIT
此问题存在于旧版本的 Jupyter Notebook 中,并在 6.0.3 版本(2020 年 1 月 21 日发布)中得到修复.要升级到最新版本,请运行:
This issue exists in older versions of Jupyter Notebook and was fixed in version 6.0.3 (released 2020-01-21). To upgrade to the latest version run:
pip install notebook --upgrade
<小时>
通过GitHub关注这个问题,看来问题与jupyter使用的tornado
服务器有关.
对于那些等不及官方修复的人,我可以通过编辑文件 tornado/platform/asyncio.py
使其工作,添加:
For those that can't wait for an official fix, I was able to get it working by editing the file tornado/platform/asyncio.py
, by adding:
import sys
if sys.platform == 'win32':
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
在主要进口之后.
不过,我希望官方尽快解决这个问题.
I expect an official fix for this soon, however.
这篇关于带有 Python 3.8 的 Jupyter Notebook - NotImplementedError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!