#!/bin/sh # ShiMeta Python 环境一键安装 # 用法: wget .../install_python.sh -O - | sh # sh install_python.sh [mirror] [version] # sh install_python.sh -v 1.0.2 VERSION="1.0.2" MIRROR="https://mirrors.shimetapi.cn/repos/GK7206/shimeta-py" case "$1" in -v) VERSION="$2"; shift 2 ;; esac case "$2" in -v) VERSION="$3"; shift 2 ;; esac case "$2" in [0-9]*.*) VERSION="$2" ;; esac if [ -n "$1" ] && [ "$1" != "-v" ]; then MIRROR="$1"; fi DEST="/mnt" echo "=== ShiMeta Python Environment Installer v${VERSION} ===" echo "Mirror: ${MIRROR}" echo "" DL="${DEST}/python-gk7206.tar.gz" URL="${MIRROR}/python-gk7206_${VERSION}_arm.tar.gz" echo "[1/2] Downloading Python 3.11 for GK7206 (18MB)..." if ! command -v wget >/dev/null 2>&1; then echo "ERROR: 未找到 wget,无法下载" exit 1 fi wget "${URL}" -O "${DL}" if [ ! -f "${DL}" ]; then echo "ERROR: download failed" exit 1 fi echo "[2/2] Extracting to ${DEST}..." cd "${DEST}" && tar xzf "${DL}" && rm -f "${DL}" rm -rf ${DEST}/python/lib/python3.11/site-packages/shimeta_py/__pycache__ 2>/dev/null echo "" grep -q "mount /dev/mmcblk1p1" /etc/profile 2>/dev/null || echo "mount /dev/mmcblk1p1 /mnt 2>/dev/null" >> /etc/profile grep -q "python/setup.sh" /etc/profile 2>/dev/null || echo ". /mnt/python/setup.sh 2>/dev/null" >> /etc/profile echo "Done. Python 3.11 installed." echo "Run: . /mnt/python/setup.sh" echo " python3 -c 'print(1+1)'"