Python3.8安装 jupyter报错 NotImplementedError
報(bào)錯(cuò)如下:
?
原因:
是由于 python3.8 asyncio 在 windows 上默認(rèn)使用 ProactorEventLoop 造成的,而不是之前的 SelectorEventLoop。jupyter 依賴(lài) tornado,而 tornado 在 window 上需要使用 SelectorEventLoop,所以產(chǎn)生這個(gè)報(bào)錯(cuò)。
On Windows, Tornado requires the ``WindowsSelectorEventLoop``. This is
the default in Python 3.7 and older, but Python 3.8 defaults to an
event loop that is not compatible with Tornado. Applications that use
Tornado on Windows with Python 3.8 must call
``asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())``
at the beginning of their ``main`` file/function.
?
而對(duì)于像 jupyter 這種依賴(lài)于 tornado 的庫(kù),則無(wú)法用這種方式。目前這個(gè)問(wèn)題已由 python 官方跟蹤:https://bugs.python.org/issue37373
臨時(shí)解決辦法:
修改 python安裝目錄\Lib\site-packages\tornado\platform\asyncio.py
import asyncio asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())也就是在?import asyncio?之后,手動(dòng)讓 tornado 選擇 SelectorEventLoop,這樣 jupyter 就可以正常使用了。
所以現(xiàn)在其實(shí)不太建議升級(jí)到 python3.8
Python目前最新版本是3.8.0,2019年10月14日發(fā)布的,從學(xué)習(xí)者與開(kāi)發(fā)者角度,都不應(yīng)該選擇最新版本,建議選擇第一版是至少一年前發(fā)布的,這樣很多第三方庫(kù)也跟進(jìn)變化了。
2019年12月10日,推薦選擇:
3.7.x版本,因?yàn)?.7.0版本是2018年6月發(fā)布的
?
總結(jié)
以上是生活随笔為你收集整理的Python3.8安装 jupyter报错 NotImplementedError的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。