自动配置国内镜像源,加速 Playwright 及其浏览器在 Linux 上的安装。
- 自动检测 Linux 发行版(Ubuntu/Debian、CentOS/RHEL、Fedora、Arch、openSUSE)
- 安装系统级依赖
- 使用清华 PyPI 镜像安装 Playwright 库
- 修补 Playwright 内部 CDN 配置文件,替换为国内镜像
- 多镜像自动回退,安装 Chromium / Firefox / WebKit 浏览器
- 支持 Playwright 1.57+ Chrome for Testing 新架构(自动设置
PLAYWRIGHT_CHROMIUM_DOWNLOAD_HOST)
| 用途 | 镜像地址 |
|---|---|
| Playwright 通用 | https://cdn.npmmirror.com/binaries/playwright |
| Playwright 备用 | https://npmmirror.com/mirrors/playwright |
| Chrome for Testing | https://cdn.npmmirror.com/binaries/chrome-for-testing |
| 官方 CDN 兜底 | https://cdn.playwright.dev |
# 默认安装 chromium
python3 playwright_install_linux.py
# 安装多个浏览器
python3 playwright_install_linux.py --browsers chromium firefox webkit
# 仅修补配置文件(不安装)
python3 playwright_install_linux.py --patch-only
# 跳过系统依赖安装
python3 playwright_install_linux.py --skip-deps
# 跳过安装验证
python3 playwright_install_linux.py --skip-verify- Python 3.7+
- Linux(其他平台可运行但部分功能不适用)
MIT