问题
在MACOS的终端Terminal中一直显示Warning:
【Config option ‘template_path`not recognized by ‘Le nvsTocHTMLExporter`. Did you mean one of: 'extra_template_paths, template_name, template_paths`?】
由于Mac用户比较少,所以我把我解决的错误贴上来以供大家参考
问题复现步骤:
- 由于我是在Mac系统中进行安装的,首先在安装miniconda环境后,进行安装,使用的命令来自于Github主页:链接为:(https://github.com/ipython-contrib/jupyter_contrib_nbextensions),使用`conda install -c conda-forge jupyter_contrib_nbextensions `命令即可安装
- 安装好后,在当前环境输入`jupyter notebook`后,进入主界面,选择安装`Table of Contents`等拓展包,然后重启再次进入Jupyter notebook
- 此时终端出现大量`Warning`,如下:
(测试后发现关闭`Table of Content(2)`后不会出现,所以问题应该出现在这个插件上,此外,这个插件有些时候目录显示不全,在目录处按住鼠标左键向左滑动可以显示全,很奇怪)
解决办法:
-
参考内容:本篇链接—(https://blog.csdn.net/weixin_44373068/article/details/127873311),但这个是Windows下的,我对比排查了对应Macos下的也一样适用,具体如下
-
由于我是通过conda安装的,对应的路径为:(jupyter3.9是我运行JupyterNotebook的环境名称,每个人都不一样)
-
路径为`/opt/miniconda3/envs/jupyter3.9/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py`,打开文件进行编辑,找到对应的代码块,将下述部分加入到文件中:
-
只加了一行代码:
template_path = template_paths
这部分的代码变为:
template_paths = List(['.']).tag(config=True, affects_environment=True)
template_path = template_paths
extra_template_basedirs = List().tag(config=True, affects_environment=True)
extra_template_paths = List([]).tag(config=True, affects_environment=True)