1 #安装
2 pip install sphinx -i https://pypi.tuna.tsinghua.edu.cn/simple
3
4 #更换国内源
5 清华源
6 pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
7
8 # 阿里源
9 pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
10 # 腾讯源
11 pip config set global.index-url https://mirrors.cloud.tencent.com/pypi/simple
12 # 豆瓣源
13 pip config set global.index-url http://pypi.douban.com/simple/
14
15 #换回默认源
16 pip config unset global.index-url
17
18 #离线下载安装包
19 pip download 包名 -d "路径(windows下双引号来表示文件夹)"
20 #离线安装
21 pip install <.whl 或者源文件包名>
22
23 #开始
24 sphinx-quickstart
25
26 #编译
27 make html
28
29 #Sphinx 默认不支持 Markdown 语法,但可以通过 recommonmark 插件来支持。另外,如果需要支持 markdown 的表格语法,还需要安装 sphinx-markdown-tables 插件。这两个插件其实我们前面已经安装好了,现在只需要在 conf.py 配置文件中添加扩展支持即可。
30 extensions = [
31 'recommonmark',
32 'sphinx_markdown_tables'
33 ]
34
35 #遇到的问题 搜索不支持中文
36 #解决方案
37 pip install jieba
38 #在conf.py配置文件中添加html_search_language = 'zh'并重新make html
39
40 #进阶 自动编译 sphinx-autobuild source build/html
41 #https://studynotes.readthedocs.io/zh/main/struct/extend/autobuild.html