【PDFMathTranslate】开源下载和安装教程
1、项目介绍
PDFMathTranslate 是一款专注于学术论文翻译的开源工具,支持保留PDF原文中的公式、图表、目录及注释的完整排版,生成双语对照文档。提供命令行工具、图形界面及Docker部署方式,支持Google/DeepL/Ollama/OpenAI等多种翻译服务。
2、项目下载位置
- GitHub仓库:主仓库地址为
Byaidu/PDFMathTranslate - PyPI包:可通过
pip install pdf2zh直接安装 - Docker镜像:
byaidu/pdf2zh或ghcr.io/byaidu/pdfmathtranslate - Windows预编译包:在GitHub Releases页面下载
pdf2zh-version-win64.zip
3、项目安装环境配置
Python环境要求
- Python 3.10~3.12
- 需安装VC运行库(Windows用户)

网络配置
若模型下载失败,需设置镜像源:
set HF_ENDPOINT=https://hf-mirror.com # Windows
export HF_ENDPOINT=https://hf-mirror.com # Linux/Mac
4、项目安装方式
方法1:UV安装(推荐)
pip install uv
uv tool install --python 3.12 pdf2zh
方法2:Windows免安装版
- 下载ZIP解压后双击
pdf2zh.exe - 首次运行会自动下载模型文件
方法3:Docker部署
docker pull byaidu/pdf2zh
docker run -d -p 7860:7860 byaidu/pdf2zh

5、项目处理脚本
基础命令行使用
pdf2zh input.pdf # 生成input-mono.pdf(单语)和input-dual.pdf(双语)
高级参数示例
| 参数 | 功能说明 |
|---|---|
-s google | 指定Google翻译 |
-t zh | 目标语言为中文 |
-i | 启动图形界面 |
批量处理脚本
import os
for file in os.listdir("pdfs"):
os.system(f"pdf2zh pdfs/{file} -t zh")
提示:完整参数说明可通过
pdf2zh --help查看
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考



