1

我已经为 Windows 安装了 Anaconda3 5.0.1。之后,我为 Jupyter notebook 安装了 nbextensions。

我在 Anaconda Prompt 中使用了以下代码进行 nbextension 安装: pip install jupyter_contrib_nbextensions jupyter-contrib nbextension install

当我打开 Jupyter 笔记本并单击 NBextensions 选项卡时,我看到以下错误并且没有将扩展添加到我的笔记本中。

Snap! Failed to load config section "notebook"
Internal Server Error
Traceback (most recent call last):
  File "C:\Users\Efseaff\Anaconda3\lib\site-packages\notebook\base\handlers.py", line 516, in wrapper
    result = yield gen.maybe_future(method(self, *args, **kwargs))
  File "C:\Users\Efseaff\Anaconda3\lib\site-packages\tornado\web.py", line 2898, in wrapper
    return method(self, *args, **kwargs)
  File "C:\Users\Efseaff\Anaconda3\lib\site-packages\notebook\services\config\handlers.py", line 20, in get
    self.finish(json.dumps(self.config_manager.get(section_name)))
  File "C:\Users\Efseaff\Anaconda3\lib\site-packages\notebook\services\config\manager.py", line 25, in get
    recursive_update(config, cm.get(section_name))
  File "C:\Users\Efseaff\Anaconda3\lib\site-packages\traitlets\config\manager.py", line 63, in get
    return json.load(f)
  File "C:\Users\Efseaff\Anaconda3\lib\json\__init__.py", line 299, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "C:\Users\Efseaff\Anaconda3\lib\json\__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Efseaff\Anaconda3\lib\json\decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\Efseaff\Anaconda3\lib\json\decoder.py", line 355, in raw_decode
    obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 5 column 3 (char 72)

在 Github 上的一个相关问题 - https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/1295 - 提问者被指示检查他们的失败 JSON 文件:C:\Users\ ... \nbconfig\notebook.json在https://jsonlint.com/

我的 C:...\notebook.json 文件是:

{
  "load_extensions": {
    "jupyter-js-widgets/extension": true
  }
  "CodeCell": {
    "cm_config": {
      "autoCloseBrackets": false,
      "cursorBlinkRate": 0
    }
  } 
}

https://jsonlint.com/的输出是:

Error: Parse error on line 4:
...xtension": true  }   "CodeCell": {       "cm_
---------------------^
Expecting 'EOF', '}', ',', ']', got 'STRING'

请帮我修复这个文件

解决了

https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html#install-javascript-and-css-filespip install jupyter_nbextensions_configurator上的 步骤没有明确显示配置它们: jupyter nbextensions_configurator enable --system 我发现它们.. . 其他地方。

4

0 回答 0