好得很程序员自学网

<tfoot draggable='sEl'></tfoot>

sphinx make html方法(rst格式转html)

从GITHUB上下载的python文档有rst格式无法打开,一般有README.txt里说明要转换为html。原文:

You need Sphinx to build this documentation. Or you can read it in ASCII. ;)

Better run:

# pip install sphinx

and once Sphinx is installed on your system, run:

$ make html

To build a copy of HTML'ed PySNMP documentation.

转换方法:

以pysnmp为例,GitHub下载的pysnmp-master文件,查看pysnmp-master\docs下,都是rst格式。现在我们需要转换为html

1.下载sphinx

pip install sphinx

2.使用sphinx转换html

将pysnmp-master.zip解压到你需要放置的目录,我这里D:\Pythonwork\pysnmp-master

找到source目录的所在目录,打开cmd,进入source目录的上级目录(我这里source目录在D:\Pythonwork\pysnmp-master\docs下),CD D:\Pythonwork\pysnmp-master\docs

执行转换命令sphinx-build -b html 源目录 目标目录,源目录必须选择 source目录 我这里因为已经进入了当前source的上级目录,因此不需要绝对路径,我的目标目录设置为html

sphinx-build -b html source D:\Pythonwork\pysnmp-master\docs\html 

完成

打开目标目录找到html文件,完美。

查看更多关于sphinx make html方法(rst格式转html)的详细内容...

  阅读:35次