docs: require Python 3.10 for obfuscated lib; prefer Ubuntu 22.04

Reject 3.12+ in setup_env to avoid bad marshal data on new servers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-18 12:15:21 +08:00
parent 1d2bdc3aa1
commit af0fbc3e6f
6 changed files with 53 additions and 15 deletions
+21 -6
View File
@@ -8,33 +8,48 @@
| 项 | 要求 |
|----|------|
| 操作系统 | **Ubuntu 22.04 LTS****24.04 LTS**(64 位) |
| 操作系统 | **优先 Ubuntu 22.04 LTS**(自带 Python 3.10)。24.04 可用,但须自行安装 **Python 3.10**,不可用系统默认 3.12 |
| 运行用户 | **root**(下文命令均按 root 编写) |
| 项目路径 | **`/opt/crypto_monitor_user`**(整仓克隆到此目录) |
| 进程管理 | **PM2**(全局安装,见 §3) |
| 网络 | 能 `git clone` 私有仓库;能访问授权站 **https://sq.bz121.com**;访问交易所不稳定时需 **SSH SOCKS**(见各所《部署文档》) |
| 授权 | 部署后配置仓库根 `license.env`,打开 `/license` 激活(见 [license.md](./license.md) |
> **新机建议直接装 22.04。** 用户版 `lib/` 核心包为 Python 3.10 加密字节码;用 3.12 启动会出现 `ValueError: bad marshal data (unknown type code)`(如 `crypto_okx` 反复重启)。
---
## 2. Python 环境
| 项 | 说明 |
|----|------|
| **版本** | **Python 3.10 或 3.11**(`python3 --version` ≥ 3.10);脚本会拒绝 3.9 及以下 |
| **虚拟环境** | 每个子项目独立 **`.venv`**(`deploy/setup_env.sh` 自动创建) |
| **版本** | **Python 3.10 或 3.11**(推荐 **3.10**)。`setup_env.sh` 会拒绝 3.9 及以下、**以及 3.12+** |
| **虚拟环境** | 每个子项目独立 **`.venv`**(`deploy/setup_env.sh` 自动创建;优先选用 `python3.10`) |
| **依赖文件** | 三所监控共用仓库根目录 **`requirements.txt`**;中控用 **`manual_trading_hub/requirements.txt`** |
| **SOCKS** | 走代理时必须安装 **PySocks**(已写入 requirements) |
### 2.1 系统包(root)
**Ubuntu 22.04(推荐):**
```bash
apt update
apt install -y python3 python3-pip python3-venv curl git ca-certificates
# python3 为 3.10:
# 22.04 上 python3 为 3.10
apt install -y python3.10-venv
# 3.12:
apt install -y python3.12-venv
python3 --version # Python 3.10.x
```
**若坚持 Ubuntu 24.04:** 勿用系统 `python3`(3.12)。需先安装 3.10,再部署:
```bash
apt update
apt install -y software-properties-common
add-apt-repository -y ppa:deadsnakes/ppa
apt update
apt install -y python3.10 python3.10-venv python3.10-dev curl git ca-certificates
python3.10 --version
# 随后一键部署;setup_env 会优先使用 python3.10
```
### 2.2 一键创建各目录 venv