记录python3.8,安装jupyter后运行jupyter notebook报错,解决

python3.8,安装jupyter后运行jupyter notebook报错

Traceback (most recent call last):
  File "h:\environment\python\3.8\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "h:\environment\python\3.8\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "H:\Environment\Python\3.8\Scripts\jupyter-notebook.EXE\__main__.py", line 9, in
  File "h:\environment\python\3.8\lib\site-packages\jupyter_core\application.py", line 268, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "h:\environment\python\3.8\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
    app.initialize(argv)
  File "", line 2, in initialize
  File "h:\environment\python\3.8\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "h:\environment\python\3.8\lib\site-packages\notebook\notebookapp.py", line 1720, in initialize
    self.init_webapp()
  File "h:\environment\python\3.8\lib\site-packages\notebook\notebookapp.py", line 1482, in init_webapp
    self.http_server.listen(port, self.ip)
  File "h:\environment\python\3.8\lib\site-packages\tornado\tcpserver.py", line 152, in listen
    self.add_sockets(sockets)
  File "h:\environment\python\3.8\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
    self._handlers[sock.fileno()] = add_accept_handler(
  File "h:\environment\python\3.8\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
    io_loop.add_handler(sock, accept_handler, IOLoop.READ)
  File "h:\environment\python\3.8\lib\site-packages\tornado\platform\asyncio.py", line 101, in add_handler
    self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
  File "h:\environment\python\3.8\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError
NotImplementedError

 

解决方式

..\Python\3.8\Lib\site-packages\tornado\platform\asyncio.py文件

添加以下代码:

import asyncio
import sys
if sys.platform == 'win32' and sys.version_info > (3, 8, 0, 'alpha', 3) :
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

解决

参考 

https://zhuanlan.zhihu.com/p/89888038

https://blog.csdn.net/zengmingen/article/details/103473267

 

 

 

 

你可能感兴趣的:(环境问题)