繁体   English   中英

加载 Jupyter Notebook 扩展时导入错误

[英]Import error when loading Jupyter Notebook Extensions

我一直在尝试按照https://research.google.com/colaboratory/local-runtimes.html上的指南在 Google Colaboratory 中连接本地运行时。 运行“jupyter notebook --NotebookApp.allow_origin='https://colab.research.google.com' --port=9090 --NotebookApp.port_retries=0”时,会产生以下错误消息:

jupyter_http_over_ws extension initialized. Listening on /http_over_websocket
[W 05:31:57.155 NotebookApp] Error loading server extension py
    Traceback (most recent call last):
      File "C:\ProgramData\Miniconda3\lib\site-packages\notebook\notebookapp.py", line 1934, in init_server_extensions
        mod = importlib.import_module(modulename)
      File "C:\ProgramData\Miniconda3\lib\importlib\__init__.py", line 127, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
      File "<frozen importlib._bootstrap>", line 991, in _find_and_load
      File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'py'
[I 05:31:57.157 NotebookApp] Serving notebooks from local directory: C:\data
[I 05:31:57.157 NotebookApp] Jupyter Notebook 6.1.1 is running at:
[I 05:31:57.157 NotebookApp] http://localhost:9090/?token=7da2b30d93fc4e57bb4bfd4db2dcf4ce621d40f92f1f2846
[I 05:31:57.157 NotebookApp]  or http://127.0.0.1:9090/?token=7da2b30d93fc4e57bb4bfd4db2dcf4ce621d40f92f1f2846
[I 05:31:57.158 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 05:31:57.161 NotebookApp]

该错误有点类似于Error loading Jupyter Notebook Extensions ,但是 jupyter_nbextensions_configurator 似乎不涉及这种情况。 无论环境如何,错误都是一样的。 重新安装 jupyter 和扩展没有帮助。

任何帮助是极大的赞赏!

在代码中挖掘了一下之后,我发现要加载的扩展配置在:

/.jupiter/jupyter_notebook_config.json

配置文件包含一个错误的条目,删除它解决了这个问题。

卸载并重新安装jupyter_contrib_nbextensions重新引入该问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM