Sphinx python 试用生成文档 错误——"sphinx-build" command not found

在windows平台下,试用sphinx python库来生成文档。

sphinx版本:1.2.3

python版本:2.7

都安装成功后,生成文档:

1 make html

然后控制台输出错误:

The 'sphinx-build' command was not found. Make sure you have Sphinx
installed, then set the SPHINXBUILD environment variable to point
to the full path of the 'sphinx-build' executable. Alternatively you
may add the Sphinx directory to PATH.

If you don't have Sphinx installed, grab it from
http://sphinx-doc.org/

看错误时提示sphinx-build这个工具没找到。可是sphinx已经安装成功了,为什么报这个错误?

进入python安装目录,c:\Python27,果然没发现这个sphinx-build相关的东西

进入c:\Python27\Scripts下,发现sphinx-build.exe,应该是这个东西。

查看sphinx的安装目录,我们的文档目录下有一个web.py的配置文件,其中有关于sphinx-build的设置。

1 if "%SPHINXBUILD%" == "" (
2     set SPHINXBUILD=sphinx-build
3 )

在找不到环境变量SPHINXBUILD的情况下会去设置。那么就不要它帮你设置,自己手动设置一个环境变量:

SPHINXBUILD <-- C:\Python27\Scripts\sphinx-build.exe

重启命令行,搞定。

posted @ 2014-10-30 18:52  simonclouds  阅读(4327)  评论(0)    收藏  举报