完善项目安装配置 & 中途改进
This commit is contained in:
40
install.bat
Normal file
40
install.bat
Normal file
@@ -0,0 +1,40 @@
|
||||
@echo off
|
||||
echo "HeurAMS 环境安装脚本"
|
||||
echo "正在检测系统中是否安装 Python 3.x..."
|
||||
|
||||
rem 检查 Python 3 是否存在
|
||||
where python >nul 2>nul
|
||||
if %errorlevel% neq 0 (
|
||||
echo "错误: 未检测到 Python. 请确保 Python 已添加到系统 PATH 中,然后再次运行此脚本。"
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
rem 检查 Python 版本是否为 3.x
|
||||
for /f "tokens=*" %%i in ('python -c "import sys; print(f'{sys.version_info.major}')"') do set PYTHON_MAJOR_VERSION=%%i
|
||||
if "%PYTHON_MAJOR_VERSION%"=="3" (
|
||||
for /f "tokens=*" %%i in ('python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"') do set PYTHON_VERSION=%%i
|
||||
echo "检测到 Python 3 已安装, 版本为: %PYTHON_VERSION%"
|
||||
) else (
|
||||
echo "错误: 未检测到 Python 3. 请先安装 Python 3, 然后再次运行此脚本."
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
echo "---"
|
||||
echo "正在安装 requirements.txt 中的依赖..."
|
||||
|
||||
rem 检查 requirements.txt 文件是否存在
|
||||
if exist "requirements.txt" (
|
||||
python -m pip install -r requirements.txt
|
||||
if %errorlevel% equ 0 (
|
||||
echo "依赖安装成功."
|
||||
) else (
|
||||
echo "错误: 依赖安装失败. 请检查 requirements.txt 文件或网络连接."
|
||||
exit /b 1
|
||||
)
|
||||
) else (
|
||||
echo "警告: 未找到 requirements.txt 文件. 跳过依赖安装."
|
||||
)
|
||||
|
||||
echo "---"
|
||||
echo "HeurAMS 的环境依赖已安装"
|
||||
pause
|
Reference in New Issue
Block a user