增加3.9

This commit is contained in:
dekun
2026-05-20 00:37:38 +08:00
parent 525d690424
commit 593f8fcff5
9 changed files with 259 additions and 13 deletions
+3 -1
View File
@@ -5,6 +5,7 @@
| 文件 | 作用 |
|------|------|
| `ecosystem.config.cjs` | PM2 配置:单实例、`PYTHONUNBUFFERED=1`、日志在 `runtime/` |
| `pick_python.sh` | 自动选择 Python 3.93.12Ubuntu 20.04 勿用默认 3.8 |
| `bootstrap.sh` | 首次:`venv` + `pip install -r requirements.txt` + 生成 `config.yaml` 模板 |
| `start.sh` | 前台运行 `python run.py`(调试用) |
| `pm2-start.sh` | PM2 启动;若应用已存在则 `restart` |
@@ -14,4 +15,5 @@
| `gate-order-executor.service` | systemd 示例(需改 `WorkingDirectory``pm2-runtime` 路径) |
使用说明与接口文档:`../docs/使用说明.md`
部署步骤:`../docs/部署说明.md`
部署步骤:`../docs/部署说明.md`
Python 3.9 专篇:仓库根目录 `Python3.9部署说明.md`
+4 -5
View File
@@ -7,12 +7,11 @@ set -euo pipefail
PROJECT_DIR="${1:-/root/gate_order_executor}"
cd "$PROJECT_DIR"
if ! command -v python3 >/dev/null 2>&1; then
echo "请先安装 python3" >&2
exit 1
fi
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PY="$("$SCRIPT_DIR/pick_python.sh")"
echo "使用解释器: $PY ($("$PY" --version))"
python3 -m venv .venv
"$PY" -m venv .venv
# shellcheck source=/dev/null
source .venv/bin/activate
python -m pip install -U pip
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
# 选出 >=3.9 的 python3 可执行文件(优先较新版本)。供 bootstrap.sh 使用。
set -euo pipefail
for cmd in python3.12 python3.11 python3.10 python3.9; do
if command -v "$cmd" >/dev/null 2>&1; then
if "$cmd" -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 9) else 1)'; then
echo "$cmd"
exit 0
fi
fi
done
if command -v python3 >/dev/null 2>&1; then
if python3 -c 'import sys; raise SystemExit(0 if sys.version_info >= (3, 9) else 1)'; then
echo python3
exit 0
fi
fi
echo "需要 Python 3.9 或更高版本。Ubuntu 20.04 请安装: sudo apt install -y python3.9 python3.9-venv python3.9-dev" >&2
echo "详见仓库根目录 Python3.9部署说明.md" >&2
exit 1