使用 nbsphinx 阅读文档

Read the Docs with nbsphinx

我为 Read the Docs 创建了自己的 docs。查看我的存储库 我的一些文档文件是 jupyter notebook,所以我使用了 nbshpinx

我在我的电脑上安装了所有依赖项,当我使用 make html 时效果很好。 但是,阅读文档会引发错误:

Running Sphinx v1.8.5
loading translations [en]... done

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 472, in load_extension
    mod = __import__(extname, None, None, ['setup'])
ModuleNotFoundError: No module named 'nbsphinx'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 303, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 228, in __init__
    self.setup_extension(extension)
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 449, in setup_extension
    self.registry.load_extension(self, extname)
  File "/home/docs/checkouts/readthedocs.org/user_builds/complex-valued-neural-networks/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 475, in load_extension
    raise ExtensionError(__('Could not import extension %s') % extname, err)
sphinx.errors.ExtensionError: Could not import extension nbsphinx (exception: No module named 'nbsphinx')

Extension error:
Could not import extension nbsphinx (exception: No module named 'nbsphinx')

this tutorial 之后我创建了两个 yml 文件并且错误更改为:

Error
Problem in your project's configuration. Invalid "conda.environment": environment not found

解决了! 我关注了this tutorial

我在readthedocs.yml中添加了:

python:
  version: 3
  install:
    - requirements: docs/requirements.txt
  system_packages: true

然后在docs/requirements.txt:

ipykernel
nbsphinx

如有疑问,您可以随时查看 repository 我在哪里做的。