Readthedocs 版本:cmake/swig 不可用

Readthedocs build: cmake/swig are not available

为了构建 readthedocs,我需要安装一些要求。这些 pip 要求之一需要 cmake 和 swig 来构建。

这种情况下还能用readthedocs吗?

似乎已经有一个关于此的已归档问题:https://github.com/rtfd/readthedocs.org/issues/2094

它包含一个解决方法:

For anyone else running into this it seems you can also hack around it using the 'READTHEDOCS' env var to conditionally modify install_requires in your setup.py.

这指向:

When RTD builds your project, it sets the READTHEDOCS environment variable to the string True. So within your Sphinx conf.py file, you can vary the behavior based on this. For example:

import os
on_rtd = os.environ.get('READTHEDOCS') == 'True'
if on_rtd:
    html_theme = 'default'
else:
    html_theme = 'nature'

OTOH,最后一条评论声称它应该适用于当前的 RTD 版本。