【CentOS-7.4】Sphinx 安装与简单配置

本文介绍了在CentOS-7.4上安装Sphinx全文检索引擎的详细步骤,包括使用rpm包和pip安装,配置环境如Python 3.5+、pip、nginx和mysql-8,以及如何使用pandoc转换文件和编辑rst文件生成PDF和Slide。同时,还探讨了Sphinx的配置,如修改主题、设置logo和文档结构。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

@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
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值