sphinx 安装

pip install sphinx
sphinx-quickstart

安装后,建立rst,就可以使用make html 生成html文件了。 这里有个疑问,rst文件放在什么位置。 其实,在shpinx-quickstart安装时,会有提示的,但实际还不知道放在哪,通过查看文档

$ sphinx-build -b html sourcedir builddir

source directory The directory which, including its subdirectories, contains all source files for one Sphinx project.

那么sourcedir 是哪个目录呢,就要看makefile文件了,

如果,在安装时 Separate source and build directories (y/n) [n]: 选择n.则makefile文件中为: ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . 反之,则为: ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source

即是,sourcedir,是根据安装时设置的。

那么,如何解决此问题呢,方法为"顺藤摸瓜",根据makefile所执行的命令,看到是sphinx-build这个命令生成的html文件。 再研究这个命令,使用 sphinx-build -h, 就找到sourcedir了。 其实"顺藤摸瓜"可以解决很多问题,因为最后能摸到线索,找到问题的本质在哪里。 COOL!