2

我正在使用 Python 3.8,这是以下内容的打印输出jupyter --version

jupyter core     : 4.6.3
jupyter-notebook : 6.0.3
qtconsole        : not installed
ipython          : 7.13.0
ipykernel        : 5.1.4
jupyter client   : 6.0.0
jupyter lab      : 2.0.0
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 5.0.4
traitlets        : 4.3.3

除了以下内容(直接来自文档)之外,我实际上什么也没做:

pip install voila
git clone https://github.com/QuantStack/voila
cd voila
voila notebooks/bqplot.ipynb

打印这个:

Traceback (most recent call last):
  File "c:\program files\python38\lib\runpy.py", line 192, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\program files\python38\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Python38\Scripts\voila.exe\__main__.py", line 7, in <module>
  File "c:\program files\python38\lib\site-packages\traitlets\config\application.py", line 664, in launch_instance
    app.start()
  File "c:\program files\python38\lib\site-packages\voila\app.py", line 509, in start
    self.listen()
  File "c:\program files\python38\lib\site-packages\voila\app.py", line 529, in listen
    self.app.listen(port)
  File "c:\program files\python38\lib\site-packages\tornado\web.py", line 2116, in listen
    server.listen(port, address)
  File "c:\program files\python38\lib\site-packages\tornado\tcpserver.py", line 152, in listen
    self.add_sockets(sockets)
  File "c:\program files\python38\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
    self._handlers[sock.fileno()] = add_accept_handler(
  File "c:\program files\python38\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
    io_loop.add_handler(sock, accept_handler, IOLoop.READ)
  File "c:\program files\python38\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler
    self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
  File "c:\program files\python38\lib\asyncio\events.py", line 501, in add_reader
    raise NotImplementedError
NotImplementedError

我是 Jupyter Notebooks/Lab 的初学者。我怎样才能解决这个问题?

4

3 回答 3

6

asyncio.py在后面添加这一行import asyncio

asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) 

https://github.com/mkdocs/mkdocs/commit/2172c9f999b17201102732a53c08e3de0dd48c74

于 2020-04-18T10:13:48.090 回答
1

它现在对我有用 4 次。也许 bcs 我只使用 pip 和一些轮子。在win10上,这可能会让你进入dep。麻烦,尤其是地理方面。但我仍然坚持和管理。我认为大多数 Windows 用户都会收到此错误,因为“未实现”......而且我认为在这种情况下,win10 行仍然有点不为人知。不过win10和pip结合起来应该没那么难。
这就是我给出这个解决方案的原因。

于 2020-06-01T21:45:43.513 回答
0

尽管@PerteTotale 的回答正确地解决了这个问题,但不建议修改图书馆的内部结构。可以改为为瞧瞧编写一个单独的启动器,同时设置适当的策略,例如:

import re
import sys

from voila.app import main

import asyncio


if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    if sys.platform == 'win32':
        asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) 
    sys.exit(main())
于 2021-02-05T08:51:49.383 回答