You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

在Sphinx文档中集成Notebook遇nbsphinx导入错误求助

解决nbsphinx导入报错的方案

报错根源是nbsphinx版本与jupyter_core版本不兼容:新版jupyter_core移除了ensure_async函数,而旧版nbsphinx仍依赖该函数。以下是具体解决方法:

  • 升级nbsphinx到最新版本(推荐):新版本已修复该依赖问题,不再调用ensure_async。执行命令:

    pip install --upgrade nbsphinx
    

    若使用conda环境,可替换为:

    conda update nbsphinx
    
  • 降级jupyter_core到兼容版本:如果暂时无法升级nbsphinx,可将jupyter_core降至<=4.12.0(该版本仍保留ensure_async)。执行命令:

    pip install jupyter_core<=4.12.0
    

    或conda命令:

    conda install jupyter_core<=4.12.0
    
  • 验证环境:执行pip list(或conda list)查看相关包版本,确保nbsphinx、jupyter_core、Sphinx三者版本相互兼容。

内容的提问来源于stack exchange,提问作者Natasha

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.01 19:20:47