天天看点

jupyter notebook 打开md文件后没有运行按钮

jupyter notebook 打开md文件后没有运行按钮

jupyter notebook是一个比较比较不错的网页版python编辑器,但是,由于很多“技术文档”都是直接以markdown(.md格式的文件)的格式编写的,而且jupyter notebook的代码文件(.ipynb)也可以转换成.md格式的文件,更为重要的是,我们从github上下载的很多学习资料也都是.md文件格式的。因此,为了能够在jupyter notebook上实现:

  1. 使用jupyter notebook浏览技术文档;
  2. 将转换成.md格式的python代码在不用转换格式的情况下直接由jupyter notebook上打开并且运行代码;
  3. 更加方便的由jupyter notebook看github下载的资料。

我们需要在jupyter notebook中加入能够阅读.md文件的功能。

如果你的notebook打开md文件后,只能阅读找不到run按钮,执行以下几步就可以了:

  1. 在Anaconda Prompt 中 运行conda list 命令,看你有没有

    notedown插件(它是用来渲染md文件的,有了它之后jupyter notebook打开md后才能运行其中的代码)。如果没有,pip

    install notedown

  2. 生成jupyter配置文件(如果已经生成过可以跳过) jupyter notebook --generate-config
  3. 将下面这一行加入到生成的配置文件的末尾(Linux/macOS一般在~/.jupyter/jupyter_notebook_config.py)

    c.NotebookApp.contents_manager_class=

    ‘notedown.NotedownContentsManager’

然后打开jupyter notebook 就可以正常使用了

参考:

1.https://www.cnblogs.com/damin1909/p/12526981.html

2.https://www.cnblogs.com/ya-cpp/p/9084527.html