安装指南
本指南将详细介绍 Zotero PDF2zh 插件的安装步骤。
Windows 用户
请使用管理员身份打开命令提示符(cmd.exe)执行所有命令。
选择您的系统
Windows 安装
1. 安装虚拟环境工具
使用 uv(推荐):
shell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"验证安装:
shell
uv --version2. 下载并解压 server
shell
# 创建并进入项目文件夹
mkdir zotero-pdf2zh
cd zotero-pdf2zh
# 下载并解压 server 文件夹
curl -L -o server.zip https://raw.githubusercontent.com/guaguastandup/zotero-pdf2zh/refs/heads/main/server.zip
tar -xf server.zip
# 进入 server 文件夹
cd server3. 安装依赖并启动
shell
# 安装依赖
pip install -r requirements.txt
# 启动服务
python server.py保持服务运行
翻译功能需要保持 server.py 运行状态,请不要关闭此窗口。
macOS 安装
1. 安装虚拟环境工具
使用 uv(推荐):
shell
wget -qO- https://astral.sh/uv/install.sh | sh
# 或使用 curl
curl -LsSf https://astral.sh/uv/install.sh | sh验证安装:
shell
uv --version2. 下载并解压 server
shell
# 创建并进入项目文件夹
mkdir zotero-pdf2zh && cd zotero-pdf2zh
# 下载并解压 server 文件夹
wget https://raw.githubusercontent.com/guaguastandup/zotero-pdf2zh/refs/heads/main/server.zip
unzip server.zip
# 进入 server 文件夹
cd server3. 安装依赖并启动
shell
# 安装依赖
pip install -r requirements.txt
# 启动服务
python server.py保持服务运行
翻译功能需要保持 server.py 运行状态,请不要关闭此窗口。
Linux 安装
1. 安装虚拟环境工具
使用 uv(推荐):
shell
wget -qO- https://astral.sh/uv/install.sh | sh
# 或使用 curl
curl -LsSf https://astral.sh/uv/install.sh | sh验证安装:
shell
uv --version2. 下载并解压 server
shell
# 创建并进入项目文件夹
mkdir zotero-pdf2zh && cd zotero-pdf2zh
# 下载并解压 server 文件夹
wget https://raw.githubusercontent.com/guaguastandup/zotero-pdf2zh/refs/heads/main/server.zip
unzip server.zip
# 进入 server 文件夹
cd server3. 安装依赖并启动
shell
# 安装依赖
pip install -r requirements.txt
# 启动服务
python server.py保持服务运行
翻译功能需要保持 server.py 运行状态。
如需后台运行:
shell
nohup python server.py > server.log 2>&1 &安装 Zotero 插件
下载最新插件:v3.0.37
在 Zotero 中打开「工具 → 插件」
将下载的 xpi 文件拖入插件窗口进行安装
如果功能未生效,请重启 Zotero
配置插件
打开「工具 → PDF2zh 首选项」
配置以下选项:
- Python Server IP: 默认为
http://127.0.0.1:8890 - 翻译引擎: 选择
pdf2zh或pdf2zh_next - LLM API: 配置翻译服务(详见 配置说明)
- Python Server IP: 默认为
命令行参数
| 参数 | 默认值 | 说明 |
|---|---|---|
--enable_venv | True | 开启虚拟环境管理 |
--env_tool | uv | 虚拟环境工具(uv/conda) |
--port | 8890 | 服务端口 |
--check_update | True | 自动检查更新 |
示例
shell
# 切换端口
python server.py --port=9999
# 使用 conda
python server.py --env_tool=conda
# 关闭虚拟环境管理
python server.py --enable_venv=False下载失败处理
如果下载 server.zip 失败,可以直接访问 server.zip 手动下载。
其他部署方式
除了直接安装,还有以下部署方式:
| 方式 | 说明 | 链接 |
|---|---|---|
| Docker | 环境隔离,适合服务器部署 | 查看 → |
| Homebrew | 自动化管理,适合 macOS/Linux | 查看 → |