增加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
+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