@20200115
官网
Sphinx 是 Sql Phrase Index (查询词组索引)的缩写,Sphinx 是一个基于 Sql 的全文检索引擎。
引用一段 Sphinx 生成文档的优点包括:
丰富的输出格式:支持输出为 HTML,LaTeX (可转换为PDF), manual pages(man), 纯文本等若干种格式
完备的交叉引用:语义化的标签,并对函式,类,引文,术语以及类似片段消息可以自动化链接
明晰的分层结构:轻松定义文档树,并自动化链接同级/父级/下级文章
美观的自动索引:可自动生成美观的模块索引
精确的语法高亮:基于 Pygments 自动生成语法高亮
开放的扩展:支持代码块的自动测试,自动包含 Python 的模块自述文档
全文检索分两个过程
索引创建(Indexing)和搜索索引(Search)
索引创建:将现实世界中所有的结构化和非结构化数据提取信息,创建索引的过程
搜索索引:得到用户的查询请求,搜索创建的索引,然后返回结果的过程
http://www.sphinx-doc.org/en/master/
配置文档
https://zh-sphinx-doc.readthedocs.io/en/latest/contents.html
环境
CentOS-7.4
Python 3.5+
pip
nginx
mysql-8
安装
方法一,使用 rpm 包安装
# 安装 python3
yum install python3
# 安装 pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py
# 更换 pip 源
pip install psm --trusted-host mirrors.aliyun.com
psm ls
psm use qinghua
# 更换虚拟环境中的源
vi /root/Pipfile
[[source]]
name = "pypi-tsinghua"
url = "https://pypi.tuna.tsinghua.edu.cn/simple/"
verify_ssl = true
# 安装 Sphinx
yum install python-sphinx
pip install sphinx sphinx-autobuild sphinx_rtd_theme
sphinx-build --version
查找 python-sphinx 依赖软件
rpm -q --requires -p python-sphinx-1.1.3-11.el7.noarch.rpm
/usr/bin/python
python(abi) = 2.7
python-docutils
python-jinja2
python-pygments
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PartialHardlinkSets) <= 4.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
方法二,使用 pip 安装 whl
pip install -U Sphinx
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Collecting Sphinx
Downloading http://mirrors.aliyun.com/pypi/packages/7d/66/a4af242b4348b729b9d46ce5db23943ce9bca7da9bbe2ece60dc27f26420/Sphinx-1.8.5-py2.py3-none-any.whl (3.1 MB)
|████████████████████████████████| 3.1 MB 1.5 MB/s
Collecting snowballstemmer>=1.1
Downloading http://mirrors.aliyun.com/pypi/packages/7d/4b/cdf1113a0e88b641893b814e9c36f69a6fda28cd88b62c7f0d858cde3166/snowballstemmer-2.0.0-py2.py3-none-an