jupyter打开错误

2020-08-21  本文已影响0人  1037号森林里一段干木头

在我重新创建一个环境后,原来可以用的jupyter突然不能用了,出现下面的错误


(base) C:\Users\bxzyz>jupyter notebook
Traceback (most recent call last):
  File "D:\anaconda\Lib\site-packages\nbformat\validator.py", line 12, in <module>
    from jsonschema import ValidationError
ModuleNotFoundError: No module named 'jsonschema'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\anaconda\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "D:\anaconda\Lib\site-packages\notebook\notebookapp.py", line 80, in <module>
    from .services.contents.manager import ContentsManager
  File "D:\anaconda\Lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
    from nbformat import sign, validate as validate_nb, ValidationError
  File "D:\anaconda\Lib\site-packages\nbformat\__init__.py", line 32, in <module>
    from .validator import validate, ValidationError
  File "D:\anaconda\Lib\site-packages\nbformat\validator.py", line 23, in <module>
    raise ImportError(str(e) + verbose_msg)
ImportError: No module named 'jsonschema'

    Jupyter notebook format depends on the jsonschema package:

        https://pypi.python.org/pypi/jsonschema

    Please install it first.


(base) C:\Users\bxzyz>

pip uninstall jupyter
pip install jupyter
后又出现这种错误.........


(base) C:\Users\bxzyz>jupyter notebook
Traceback (most recent call last):
  File "D:\anaconda\Lib\site-packages\jsonschema\__init__.py", line 31, in <module>
    from importlib import metadata
ImportError: cannot import name 'metadata' from 'importlib' (D:\anaconda\lib\importlib\__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\anaconda\Scripts\jupyter-notebook-script.py", line 6, in <module>
    from notebook.notebookapp import main
  File "D:\anaconda\Lib\site-packages\notebook\notebookapp.py", line 80, in <module>
    from .services.contents.manager import ContentsManager
  File "D:\anaconda\Lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
    from nbformat import sign, validate as validate_nb, ValidationError
  File "D:\anaconda\Lib\site-packages\nbformat\__init__.py", line 32, in <module>
    from .validator import validate, ValidationError
  File "D:\anaconda\Lib\site-packages\nbformat\validator.py", line 12, in <module>
    from jsonschema import ValidationError
  File "D:\anaconda\Lib\site-packages\jsonschema\__init__.py", line 33, in <module>
    import importlib_metadata as metadata
  File "D:\anaconda\Lib\site-packages\importlib_metadata\__init__.py", line 623, in <module>
    __version__ = version(__name__)
  File "D:\anaconda\Lib\site-packages\importlib_metadata\__init__.py", line 585, in version
    return distribution(distribution_name).version
  File "D:\anaconda\Lib\site-packages\importlib_metadata\__init__.py", line 285, in version
    return self.metadata['Version']
  File "D:\anaconda\Lib\site-packages\importlib_metadata\__init__.py", line 273, in metadata
    self.read_text('METADATA')
  File "D:\anaconda\Lib\site-packages\importlib_metadata\__init__.py", line 545, in read_text
    return self._path.joinpath(filename).read_text(encoding='utf-8')
AttributeError: 'WindowsPath' object has no attribute 'read_text'

原因:https://stackoverflow.com/questions/59216175/importerror-cannot-import-name-metadata-from-importlib

image.png

又是版本问题。。。。。。。
pip install jsonschema==3.0.2
安装完就ok了


image.png
上一篇下一篇

猜你喜欢

热点阅读