Python >> Tutoriel Python >  >> Python Tag >> JuPyter

Bloc-notes Jupyter avec Python 3.8 - NotImplementedError

MODIFIER

Ce problème existe dans les anciennes versions de Jupyter Notebook et a été corrigé dans la version 6.0.3 (publié le 21/01/2020). Pour mettre à niveau vers la dernière version, exécutez :

pip install notebook --upgrade

Suite à ce problème via GitHub, il semble que le problème soit lié au tornado serveur utilisé par jupyter.

Pour ceux qui ne peuvent pas attendre un correctif officiel, j'ai pu le faire fonctionner en éditant le fichier tornado/platform/asyncio.py , en ajoutant :

import sys

if sys.platform == 'win32':
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

Après les principales importations.

J'attends un correctif officiel pour cela bientôt, cependant.


Révision de la réponse en 2019

Modifier la partie finale du fichierC:\Users\{USER-NAME}\AppData\Local\Programs\Python\Python38\Lib\asyncio\__init__.py

De

if sys.platform == 'win32':  # pragma: no cover
    from .windows_events import *
    __all__ += windows_events.__all__
else:
    from .unix_events import *  # pragma: no cover
    __all__ += unix_events.__all__

À

import asyncio

if sys.platform == 'win32':
    from .windows_events import *
    asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
    __all__ += windows_events.__all__
else:
    from .unix_events import *  # pragma: no cover
    __all__ += unix_events.__all__