(Mac/Miniconda)JupyterNotebook在安装nbextension后出现‘template_path‘问题(Warning)

问题

在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)

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值