Skip to main content
 首页 » 编程设计

python之阅读文档构建 : cmake/swig are not available

2024年10月01日6zhengyun_ustc

为了构建 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 版本。