Qionk/a-share-quant
0
1# ============================================================2# A-Share Quant 本地训练一键启动脚本 (Git Bash)3# 使用方法: bash scripts/setup_and_train.sh4# ============================================================5 6echo ""7echo "============================================================"8echo " A-Share Quant 本地训练环境配置 & 启动"9echo " $(date)"10echo "============================================================"11echo ""12 13# ── 1. 设置 MySQL 环境变量 ──────────────────────────────14echo "[步骤 1/4] 配置 MySQL 数据库连接..."15export MYSQL_HOST="mysql3.sqlpub.com"16export MYSQL_PORT="3308"17export MYSQL_USER="root_quant"18export MYSQL_PASSWORD="BLnVlQ8qASfhA9xZ"19export MYSQL_DATABASE="a_share_quant"20echo " MYSQL_HOST = $MYSQL_HOST"21echo " MYSQL_PORT = $MYSQL_PORT"22echo " MYSQL_USER = $MYSQL_USER"23echo " MYSQL_DATABASE = $MYSQL_DATABASE"24echo " [OK] 环境变量已设置"25echo ""26 27# ── 2. 检查 Python ────────────────────────────────────────28echo "[步骤 2/4] 检查 Python 环境..."29if ! command -v python &> /dev/null; then30 echo " [错误] 未找到 Python! 请先安装 Python 3.11+"31 exit 132fi33python --version34echo " [OK] Python 可用"35echo ""36 37# ── 3. 安装/更新依赖 ─────────────────────────────────────38echo "[步骤 3/4] 安装 Python 依赖..."39pip install -r requirements.txt --quiet40echo " [OK] 依赖安装完成"41echo ""42 43# ── 4. 启动训练 ──────────────────────────────────────────44echo "[步骤 4/4] 启动批量训练..."45echo "============================================================"46echo ""47python scripts/train_all_stocks.py48echo ""49echo "============================================================"50echo " 训练进程结束"51echo "============================================================"