49 lines
1.8 KiB
Markdown
49 lines
1.8 KiB
Markdown
# asyncmy 离线安装说明
|
||
|
||
本目录用于给无法联网的后端服务器补装 MySQL 异步驱动 `asyncmy==0.2.11`。
|
||
|
||
项目的 `pyproject.toml` 已经声明该依赖;服务器启动报 `MySQL async driver is not installed`,说明实际运行后端的 Python 虚拟环境尚未安装它。
|
||
|
||
## 文件选择
|
||
|
||
- `asyncmy-0.2.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl`:Ubuntu、CentOS、RHEL、Debian 等常见 glibc Linux(x86_64)。
|
||
- `asyncmy-0.2.11-cp312-cp312-musllinux_1_2_x86_64.whl`:Alpine Linux(x86_64)。
|
||
|
||
这两个 wheel 都只适用于 **CPython 3.12、x86_64**。在服务器执行 `python -V` 和 `uname -m` 确认:应分别显示 Python 3.12 和 `x86_64`/`amd64`。
|
||
|
||
## 安装步骤
|
||
|
||
1. 将整个 `offline-wheels` 目录复制到后端目录(与 `pyproject.toml` 同级)。
|
||
2. 进入后端实际运行的虚拟环境;若项目使用默认虚拟环境:
|
||
|
||
```bash
|
||
cd /path/to/backend
|
||
source .venv/bin/activate
|
||
```
|
||
|
||
3. 普通 Linux(Ubuntu/CentOS/RHEL/Debian)执行:
|
||
|
||
```bash
|
||
python -m pip install --no-index ./offline-wheels/asyncmy/asyncmy-0.2.11-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
|
||
```
|
||
|
||
Alpine Linux 则执行:
|
||
|
||
```bash
|
||
python -m pip install --no-index ./offline-wheels/asyncmy/asyncmy-0.2.11-cp312-cp312-musllinux_1_2_x86_64.whl
|
||
```
|
||
|
||
4. 验证:
|
||
|
||
```bash
|
||
python -c "import asyncmy; print(asyncmy.__version__)"
|
||
```
|
||
|
||
5. 重启后端服务。
|
||
|
||
## 注意事项
|
||
|
||
- 必须使用**启动后端服务的同一个 Python/虚拟环境**安装,系统 Python 安装成功并不代表服务能找到该包。
|
||
- 不要使用 `--force-reinstall`;安装缺失的 `asyncmy` 即可。
|
||
- 若服务器是 Python 3.13、ARM/aarch64,或不是上述 Linux 类型,请不要安装本目录 wheel,需要下载对应平台版本。
|