自动部署工具.bat 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. @echo off
  2. setlocal enabledelayedexpansion
  3. cd /d "%~dp0"
  4. echo ========================================
  5. echo Game Configuration Tool - Auto Deploy
  6. echo ========================================
  7. echo.
  8. echo This script will automatically:
  9. echo 1. Check Python environment
  10. echo 2. Install required dependencies
  11. echo 3. Launch configuration tool
  12. echo.
  13. echo Starting deployment...
  14. echo.
  15. :: Check Python environment
  16. echo [Step 1/3] Checking Python environment...
  17. echo.
  18. set PYTHON_CMD=
  19. for %%i in (python py python3) do (
  20. %%i --version >nul 2>&1
  21. if !errorlevel! equ 0 (
  22. set PYTHON_CMD=%%i
  23. goto :python_found
  24. )
  25. )
  26. echo [ERROR] Python not found!
  27. echo Please visit https://www.python.org/downloads/ to install Python
  28. echo Make sure to check "Add Python to PATH" during installation
  29. echo.
  30. goto :error_exit
  31. :python_found
  32. echo [SUCCESS] Python environment check passed
  33. %PYTHON_CMD% --version
  34. echo.
  35. :: Check dependencies
  36. echo [Step 2/3] Checking and installing dependencies...
  37. echo.
  38. :: Check pandas
  39. echo Checking pandas...
  40. %PYTHON_CMD% -c "import pandas" >nul 2>&1
  41. if errorlevel 1 (
  42. echo pandas not found, installing...
  43. %PYTHON_CMD% -m pip install pandas>=1.3.0
  44. if errorlevel 1 (
  45. echo [ERROR] pandas installation failed! Trying Chinese mirror...
  46. %PYTHON_CMD% -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas>=1.3.0
  47. if errorlevel 1 (
  48. echo [ERROR] Failed to install pandas!
  49. goto :error
  50. )
  51. )
  52. echo [SUCCESS] pandas installed
  53. ) else (
  54. echo [SUCCESS] pandas already installed
  55. )
  56. :: Check openpyxl
  57. echo Checking openpyxl...
  58. %PYTHON_CMD% -c "import openpyxl" >nul 2>&1
  59. if errorlevel 1 (
  60. echo openpyxl not found, installing...
  61. %PYTHON_CMD% -m pip install openpyxl>=3.0.0
  62. if errorlevel 1 (
  63. echo [ERROR] openpyxl installation failed! Trying Chinese mirror...
  64. %PYTHON_CMD% -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple openpyxl>=3.0.0
  65. if errorlevel 1 (
  66. echo [ERROR] Failed to install openpyxl!
  67. goto :error
  68. )
  69. )
  70. echo [SUCCESS] openpyxl installed
  71. ) else (
  72. echo [SUCCESS] openpyxl already installed
  73. )
  74. echo.
  75. echo [SUCCESS] All dependencies check completed!
  76. echo.
  77. :: Launch configuration tool
  78. echo [Step 3/3] Launching configuration tool...
  79. echo.
  80. if not exist "config_manager.py" (
  81. echo [ERROR] config_manager.py file not found!
  82. echo Please make sure to run this script in the correct directory
  83. pause
  84. exit /b 1
  85. )
  86. echo Starting configuration management tool...
  87. echo.
  88. echo ========================================
  89. echo Tool started successfully! Please operate in the popup window
  90. echo ========================================
  91. echo.
  92. echo Instructions:
  93. echo 1. Select Excel configuration files on the left
  94. echo 2. Click "Preview Selected Files" to view content
  95. echo 3. Click "Import Configuration" to complete data import
  96. echo.
  97. echo Closing this window will also close the configuration tool
  98. echo.
  99. %PYTHON_CMD% config_manager.py
  100. echo.
  101. echo Configuration tool closed
  102. pause
  103. exit /b 0
  104. :error
  105. echo.
  106. echo ========================================
  107. echo [ERROR] Deployment failed!
  108. echo ========================================
  109. echo.
  110. echo Possible solutions:
  111. echo 1. Check network connection
  112. echo 2. Manual installation:
  113. echo %PYTHON_CMD% -m pip install pandas openpyxl
  114. echo 3. Use Chinese mirror:
  115. echo %PYTHON_CMD% -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pandas openpyxl
  116. echo 4. Contact technical support
  117. echo.
  118. pause
  119. exit /b 1
  120. :error_exit
  121. pause
  122. exit /b 1