一键部署工具.bat 3.7 KB

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