update-enviroment-list.bat 971 B

123456789101112131415161718192021222324252627282930313233
  1. @echo off
  2. chcp 65001 >nul
  3. title Update Python Environment List
  4. cd /d "%~dp0"
  5. REM 环境目录(python/arm64 或 python/x64),优先使用 env\Scripts\python.exe
  6. for /f "delims=" %%i in ('node "%~dp0..\..\configs\get-python-env-path.js" 2^>nul') do set "ENV_BASE=%%i"
  7. if not defined ENV_BASE set "ENV_BASE=%~dp0"
  8. set "PYTHON_EXE="
  9. if exist "%ENV_BASE%\env\Scripts\python.exe" set "PYTHON_EXE=%ENV_BASE%\env\Scripts\python.exe"
  10. if not defined PYTHON_EXE if exist "%ENV_BASE%\Scripts\python.exe" set "PYTHON_EXE=%ENV_BASE%\Scripts\python.exe"
  11. if not defined PYTHON_EXE if exist "%ENV_BASE%\py\python.exe" set "PYTHON_EXE=%ENV_BASE%\py\python.exe"
  12. if not defined PYTHON_EXE (
  13. echo [ERROR] Python not found under %ENV_BASE%
  14. pause
  15. exit /b 1
  16. )
  17. "%PYTHON_EXE%" "%~dp0update-environment-list.py"
  18. if errorlevel 1 (
  19. echo.
  20. echo [ERROR] Update failed
  21. echo.
  22. pause
  23. exit /b 1
  24. ) else (
  25. echo.
  26. echo [OK] Update completed
  27. echo.
  28. pause
  29. )