75 lines
1.5 KiB
Markdown
75 lines
1.5 KiB
Markdown
# 桌面端启动
|
||
|
||
## Python 要求
|
||
|
||
桌面端当前依赖 `pywebview`,在 Windows 下建议使用:
|
||
|
||
- `Python 3.12`
|
||
- `Python 3.11`
|
||
|
||
不要直接用 `Python 3.14`。你当前遇到的 `pythonnet` 构建失败就是这个兼容性问题。
|
||
|
||
## 开发模式
|
||
|
||
前置条件:
|
||
|
||
- `frontend-vue` 的 Vite 开发服务已启动在 `http://127.0.0.1:5173`
|
||
- 后端 API 已启动在 `http://127.0.0.1:8000`
|
||
- 本机已安装 `Python 3.12` 或 `Python 3.11`
|
||
|
||
启动命令:
|
||
|
||
```powershell
|
||
cd F:\project\crawler-plugin
|
||
.\desktop\run_desktop_dev.ps1
|
||
```
|
||
|
||
脚本会自动:
|
||
|
||
- 选择兼容的 Python 解释器
|
||
- 安装 `desktop/requirements.txt`
|
||
- 启动 `pywebview` 桌面窗口
|
||
|
||
如果脚本检测不到兼容 Python,会直接提示并退出,不再继续错误安装。
|
||
|
||
## 发布模式
|
||
|
||
先构建前端:
|
||
|
||
```powershell
|
||
cd F:\project\crawler-plugin\frontend-vue
|
||
npm run build
|
||
```
|
||
|
||
再启动桌面端:
|
||
|
||
```powershell
|
||
cd F:\project\crawler-plugin
|
||
.\desktop\run_desktop_dist.ps1
|
||
```
|
||
|
||
## 手动安装依赖
|
||
|
||
如果要手动安装,请显式使用兼容版本,例如:
|
||
|
||
```powershell
|
||
py -3.12 -m pip install -r .\desktop\requirements.txt
|
||
```
|
||
|
||
## 当前桌面能力
|
||
|
||
- 选择品牌 Excel 文件
|
||
- 选择文件夹
|
||
- 选择保存目录
|
||
- 另存模板文件
|
||
- 按 URL 下载结果文件到本地
|
||
|
||
## 说明
|
||
|
||
发布模式下,桌面宿主会:
|
||
|
||
- 本地托管 `frontend-vue/dist`
|
||
- 将 `/api`、`/login`、`/logout`、`/static` 代理到 `--backend-url`
|
||
|
||
所以后端仍然需要运行。
|