在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
相关产品推荐
相关产品推荐

