本地部署


文档摘要

本地部署 Sphinx 环境安装 AI 系统项目部署在 Github 是依赖于 sphinx 工具实现的。因此我们首先要安装 sphinx。在 MacOS 中,可以使用 Homebrew 、 MacPorts 或者 Anaconda 之类的 Python 发行版安装 Sphinx。 接着通过 安装 : 然后,在 Sphinx 配置( )中激活主题: 这将为您的文档激活 图书主题。 写入内容与图片 因为《AI 系统》的内容都存放在 https://github.com/chenzomi12/AISystem/ 地址上,因此需要通过 github desktop 或者 git clone http 的方式拉取下来到本地。

本地部署

Sphinx 环境安装

AI 系统项目部署在 Github 是依赖于 sphinx 工具实现的。因此我们首先要安装 sphinx。在 MacOS 中,可以使用 Homebrew 、 MacPorts 或者 Anaconda 之类的 Python 发行版安装 Sphinx。

brew install sphinx-doc

接着通过 pip 安装 sphinx-book-theme

pip install sphinx-book-theme

然后,在 Sphinx 配置(conf.py)中激活主题:

... html_theme = "sphinx_book_theme" ...

这将为您的文档激活 sphinx_book_theme 图书主题。

写入内容与图片

因为《AI 系统》的内容都存放在 https://github.com/chenzomi12/AISystem/ 地址上,因此需要通过 github desktop 或者 git clone http 的方式拉取下来到本地。

因为网络不稳定的问题,建议翻墙或者直接使用 github desktop 软件应用下载,使其支持断点下载项目。

接着进入 AISystem 目录下的 build_books 文件,并修改里面的源目录地址 xxxxx/AISystem 和目标构建本地部署内容的地址 xxxxx/AISystem_BOOK

target_dir1 = '/xxxxx/AISystem/02Hardware' target_dir2 = '/xxxxx/AISystem/03Compiler' target_dir3 = '/xxxxx/AISystem/04Inference' target_dir4 = '/xxxxx/AISystem/05Framework' dir_paths = '/xxxxx/AISystem_BOOK/source/' getallfile(target_dir1) getallfile(target_dir2) getallfile(target_dir3) getallfile(target_dir4)

最后执行 build_books/create_dir.py 文件,实现写入本地部署的内容与图片。

python create_dir.py

编译 HTML 版本

在编译前先去到需要编译的目录,所有的编译命令都在这个文件目录内执行。

cd AISystem_BOOK make html

生成的 html 会在build/html,打开目录下的 html 文件即可进入本地部署环境。

此时我们将编译好的 html 整个文件夹下的内容拷贝至 xxxxxx.github.io 发布。

需要注意的是 docs(AISystem_BOOK) 目录下的 /source/index.md 不要删除了,不然网页无法检索渲染。

配置文件与代码

AI 系统在 Sphinx 配置(conf.py)中的全部配置内容:

需要渲染的主页链接 index.mdconf.py 一样放在 source 文件目录下:


发布者: 作者: 转发
评论区 (0)
U