为jupyter笔记本启用python-markdown扩展时出错

时间:2018-02-07 02:31:56

标签: python jupyter-notebook

我已下载并安装了位于python-markdown repo内的nbextensions扩展程序:

jupyter_contrib_nbextensions/src/jupyter_contrib_nbextensions/nbextensions/python-markdown/python-markdown.yaml

jupyter-nbextension install python-markdown

在安装结束时,发布以下内容:

Copying: /git/jupyter_contrib_nbextensions/src/jupyter_contrib_nbextensions/nbextensions/python-markdown/python-markdown-post.png -> /usr/local/share/jupyter/nbextensions/python-markdown/python-markdown-post.png

To initialize this nbextension in the browser every time the notebook (or other app) loads:

      jupyter nbextension enable <the entry point>

所以我试过了:

$jupyter nbextension enable python-markdown

给出了:

Enabling notebook extension python-markdown...
      - Validating: problems found:
        - require?  X python-markdown

我不确定如何继续这里。

1 个答案:

答案 0 :(得分:2)

简短回答
jupyter nbextension enable python-markdown/main

答案很长

文件似乎不太清楚,但它说明......

  jupyter nbextension enable <nbextension require path>

因此,我们必须提供与扩展相关的js文件的路径。要弄清楚实际文件是什么,我们应该查找jupyter数据路径

>>>foo$ jupyter --paths
config:
    /Users/foo/.jupyter
    /Users/foo/miniconda3/etc/jupyter
    /usr/local/etc/jupyter
    /etc/jupyter
data:
    /Users/foo/Library/Jupyter
    /Users/foo/miniconda3/share/jupyter
    /usr/local/share/jupyter
    /usr/share/jupyter
runtime:
    /Users/foo/Library/Jupyter/runtime

我查看了/Users/foo/Library/Jupyter文件夹

>>>foo$ find  /Users/foo/Library/Jupyter -name python-markdown
/Users/foo/Library/Jupyter/nbextensions/python-markdown
>>>foo$ find /Users/foo/Library/Jupyter/nbextensions/python-markdown -name *js
/Users/foo/Library/Jupyter/nbextensions/python-markdown/main.js

现在我决定将路径用作python-markdown/main: -

>>>foo$ jupyter nbextension enable python-markdown/main
Enabling notebook extension python-markdown/main...
      - Validating: OK
>>>foo$ jupyter nbextension list
Known nbextensions:
  config dir: /Users/foo/.jupyter/nbconfig
    notebook section
      python-markdown  enabled 
      - Validating: problems found:
        - require?  X python-markdown
      python-markdown/main  enabled 
      - Validating: OK

编辑上面的输出反映出更合适的线条。

请注意,我的旧版python-markdown仍然无法验证,但现在已启用并验证了新的python-markdown/main