Jupyter Book的MyBinder启动按钮路径错误问题求助
解决Jupyter Book的MyBinder启动按钮路径错误问题
问题场景
在GitHub Pages发布带有MyBinder启动按钮的Jupyter Book时,使用以下_config.yml配置:
launch_buttons: notebook_interface: "jupyterlab" binderhub_url: "https://mybinder.org"
通过命令构建并部署:
jupyter-book build <directory> ghp_import -n -p -f _build/html
点击MyBinder启动按钮时,出现路径错误提示:
Cannot open
Could not find path: docs/<file_name>.ipynb
Dismiss
需求是让MyBinder直接从GitHub仓库主分支的根目录启动目标.ipynb文件。
解决方案
在_config.yml的launch_buttons下添加binder_repo_root配置项,指定仓库根目录作为Notebook的来源路径:
launch_buttons: notebook_interface: "jupyterlab" binderhub_url: "https://mybinder.org" binder_repo_root: "."
该配置会覆盖默认的路径规则,让生成的MyBinder链接直接指向仓库主分支的根目录,从而正确找到根目录下的目标.ipynb文件。
内容的提问来源于stack exchange,提问作者cmg
相关产品推荐
相关产品推荐

