60 lines
881 B
Markdown
60 lines
881 B
Markdown
# 部署说明
|
||
|
||
## 问题背景
|
||
|
||
原代码使用 `webdriver-manager` 自动下载 chromedriver,但存在以下问题:
|
||
|
||
1. 驱动版本不匹配
|
||
2. 架构混淆(32/64位)
|
||
3. 文件损坏
|
||
|
||
## 解决方案
|
||
|
||
**打包预下载的驱动 together,避免运行时动态下载**
|
||
|
||
### 1. 准备驱动
|
||
|
||
```bash
|
||
python setup_driver.py
|
||
```
|
||
|
||
或
|
||
```bash
|
||
install_driver.bat
|
||
```
|
||
|
||
### 2. 打包程序
|
||
|
||
```bash
|
||
build_for_delivery.bat
|
||
```
|
||
|
||
或
|
||
```bash
|
||
pyinstaller ArticleReplace_optimized.spec
|
||
```
|
||
|
||
### 3. 分发
|
||
|
||
打包后的程序位于 `dist/ArticleReplace/`,无需安装任何依赖。
|
||
|
||
## 技术细节
|
||
|
||
### get_web_content.py 的改进
|
||
|
||
1. 移除 webdriver-manager 依赖
|
||
2. 驱动路径查找顺序
|
||
3. 异常处理改进
|
||
|
||
## 文件清单
|
||
|
||
```
|
||
drivers/
|
||
├── chromedriver64.exe
|
||
└── chromedriver32.exe
|
||
setup_driver.py
|
||
install_driver.bat
|
||
build_for_delivery.bat
|
||
DEPLOY.md
|
||
```
|