From 6f2e2c1e8d1aaad06ce90b8de6cba28793bc8939 Mon Sep 17 00:00:00 2001 From: XXXXRT666 <157766680+XXXXRT666@users.noreply.github.com> Date: Thu, 4 Sep 2025 23:46:25 +0800 Subject: [PATCH] . --- install.ps1 | 6 ++++++ install.sh | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/install.ps1 b/install.ps1 index ab761ba8..ec7dc40b 100644 --- a/install.ps1 +++ b/install.ps1 @@ -49,6 +49,12 @@ function Write-Success($msg) { Write-Host " $msg" } +python -c "import sys; sys.exit(0 if sys.version_info >= (3,10) else 1)" +if ($LASTEXITCODE -ne 0) { + Write-Error "Python version < 3.10" + exit 1 +} + function Invoke-Conda { param ( diff --git a/install.sh b/install.sh index a66cd0ed..b11ff7a3 100644 --- a/install.sh +++ b/install.sh @@ -34,7 +34,7 @@ on_error() { run_conda_quiet() { local output output=$(conda install --yes --quiet -c conda-forge "$@" 2>&1) || { - echo -e "${ERROR} Conda install failed:\n$output" + echo -e "${ERROR}Conda install failed:\n$output" exit 1 } } @@ -42,7 +42,7 @@ run_conda_quiet() { run_pip_quiet() { local output output=$(pip install "$@" 2>&1) || { - echo -e "${ERROR} Pip install failed:\n$output" + echo -e "${ERROR}Pip install failed:\n$output" exit 1 } } @@ -51,7 +51,7 @@ run_wget_quiet() { if wget --tries=25 --wait=5 --read-timeout=40 -q --show-progress "$@" 2>&1; then tput cuu1 && tput el else - echo -e "${ERROR} Wget failed" + echo -e "${ERROR}Wget failed" exit 1 fi } @@ -85,6 +85,11 @@ print_help() { echo " bash install.sh --device MPS --source ModelScope" } +if ! python3 -c "import sys; sys.exit(0 if sys.version_info >= (3,10) else 1)"; then + echo -e "${ERROR}Python version < 3.10" + exit 1 +fi + # Show help if no arguments provided if [[ $# -eq 0 ]]; then print_help @@ -106,7 +111,7 @@ while [[ $# -gt 0 ]]; do USE_MODELSCOPE=true ;; *) - echo -e "${ERROR}Error: Invalid Download Source: $2" + echo -e "${ERROR}Invalid Download Source: $2" echo -e "${ERROR}Choose From: [HF, HF-Mirror, ModelScope]" exit 1 ;; @@ -133,7 +138,7 @@ while [[ $# -gt 0 ]]; do USE_CPU=true ;; *) - echo -e "${ERROR}Error: Invalid Device: $2" + echo -e "${ERROR}Invalid Device: $2" echo -e "${ERROR}Choose From: [CU126, CU128, ROCM, MPS, CPU]" exit 1 ;; @@ -158,14 +163,14 @@ while [[ $# -gt 0 ]]; do done if ! $USE_CUDA && ! $USE_ROCM && ! $USE_MLX && ! $USE_CPU; then - echo -e "${ERROR}Error: Device is REQUIRED" + echo -e "${ERROR}Device is REQUIRED" echo "" print_help exit 1 fi if ! $USE_HF && ! $USE_HF_MIRROR && ! $USE_MODELSCOPE; then - echo -e "${ERROR}Error: Download Source is REQUIRED" + echo -e "${ERROR}Download Source is REQUIRED" echo "" print_help exit 1 @@ -215,8 +220,8 @@ else else XCODE_PATH=$(xcode-select -p) if [[ "$XCODE_PATH" == *"Xcode.app"* ]]; then - echo -e "${WARNING} Detected Xcode path: $XCODE_PATH" - echo -e "${WARNING} If your Xcode version does not match your macOS version, it may cause unexpected issues during compilation or package builds." + echo -e "${WARNING}Detected Xcode path: $XCODE_PATH" + echo -e "${WARNING}If your Xcode version does not match your macOS version, it may cause unexpected issues during compilation or package builds." fi fi fi