rst2man 安装说明
rst2man来自 docutils(Python文档工具集),用来把 reStructuredText 转成 man 手册页。
(1)Debian / Ubuntu
sudo apt update
sudo apt install docutils-common
(2)Fedora / Rocky / RHEL
sudo dnf install python3-docutils
(3) Arch Linux
sudo pacman -S python-docutils
(4)通用 pip 安装(所有Linux,推荐虚拟环境)
# 全局安装
sudo pip3 install docutils
# 或者用户本地安装(不需要root)
pip3 install --user docutils
验证安装
rst2man --version
简单使用示例
# 将 test.rst 生成 man 手册 test.1
rst2man test.rst test.1
# 查看
man ./test.1
常见问题
- pip安装后提示 command not found:
把 `~/.local/bin` 加到 PATH:
export PATH="$HOME/.local/bin:$PATH"
- 系统包版本老,优先用 pip 安装新版 docutils。