【问题标题】:Can't open jupyter notebook due to jsonschema [already tried other solutions on stackoverflow]由于 jsonschema 无法打开 jupyter notebook [已经在 stackoverflow 上尝试过其他解决方案]
【发布时间】:2020-06-04 01:16:21
【问题描述】:

我在 Windows 10 机器上使用 python 3.8。 我通常在其中使用 VS Code 和 ipynb(没有 anaconda),一切运行顺利 几天前,我开始遇到以下错误:

    Traceback (most recent call last):
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\site-packages\nbformat\validator.py", line 12, in <module>
    from jsonschema import ValidationError
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\site-packages\jsonschema\__init__.py", line 34, in <module>
    __version__ = metadata.version("jsonschema")
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\importlib\metadata.py", line 531, in version
    return distribution(distribution_name).version
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\importlib\metadata.py", line 504, in distribution
    return Distribution.from_name(distribution_name)
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\importlib\metadata.py", line 177, in from_name
    raise PackageNotFoundError(name)
importlib.metadata.PackageNotFoundError: jsonschema

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\kshit\OneDrive - University of Waterloo\Programming\Python\Installation\Scripts\jupyter-notebook.EXE\__main__.py", line 5, in <module>
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\site-packages\notebook\notebookapp.py", line 80, in <module>
    from .services.contents.manager import ContentsManager
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\site-packages\notebook\services\contents\manager.py", line 17, in <module>
    from nbformat import sign, validate as validate_nb, ValidationError
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\site-packages\nbformat\__init__.py", line 32, in <module>
    from .validator import validate, ValidationError
  File "c:\users\kshit\onedrive - university of waterloo\programming\python\installation\lib\site-packages\nbformat\validator.py", line 23, in <module>
    raise ImportError(str(e) + verbose_msg)
ImportError: jsonschema

    Jupyter notebook format depends on the jsonschema package:

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

    Please install it first.

我尝试在stackoverflow上搜索解决方案: Can't use Jupyter Notebook: jsonschema apparently missing

但是那里的答案都没有对我有用。

我尝试多次升级 jsonschema、jupyter 和 pip 本身,但无济于事。 也尝试在 Pycharm 中运行它, 而且我相信我的 python 环境中没有改变任何东西。

非常感谢任何帮助。

谢谢, 克什蒂杰。

【问题讨论】:

    标签: python python-3.x jupyter-notebook jsonschema


    【解决方案1】:

    你不应该使用pip install --upgrade pip 来升级 pip - 它会抛出一些错误。你应该从网站上这样做。 jupyter notebook 的临时解决方案是 Google Colab - colab.research.withgoogle.com。它还使用 .ipynb。希望这会有所帮助!

    【讨论】:

    • 嗯,你为什么不使用pip install --upgrade pip
    • 有时会报错,pip代码有时会报错。您可能需要从网站下载新版本。
    猜你喜欢
    • 2022-11-01
    • 2020-09-02
    • 1970-01-01
    • 2022-01-03
    • 1970-01-01
    • 2019-09-02
    • 2018-03-18
    • 2019-10-24
    • 2018-11-27
    相关资源
    最近更新 更多