Read the Docs 的官方文档也没有找到在 Windows 下的编译脚本,网上各种搜索也找不到相关的资料,无意间在一个项目里面发现了这个 Makefile.bat 很久,运行 make html 果然编译成功,在这里备份一下,方便下次使用。
@ECHO OFF
pushd %~dp0
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build
if "%1" == "" goto help
%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end
:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
:end
popd
如果你直接运行可能会报错,下面来看看我遇到一些错误。
如果提示 缺少 conf.py 文件,打开 makefile 文件看看配置哪儿,比如我的这个项目:
SPHINXOPTS =
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = ../build
CONFDIR = ../config
PYTHON = python3
LANG = zh
SPHINX_LANG = zh_CN
上层目录有一个 config 文件,打开果然存在 conf.py 文件。
这是 Python 缺少某些模块,直接安装即可。
找到源代码里面的这一行,直接注释掉,跟他相关的一并注释。
主题找不到,可能原作者使用了一些其他的主题,先注释调把项目跑起来再说。

