This commit is contained in:
XXXXRT666 2025-09-04 23:46:25 +08:00
parent 34a9d018c6
commit 6f2e2c1e8d
2 changed files with 20 additions and 9 deletions

View File

@ -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 (

View File

@ -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