setup-windows-en.bat 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. @echo off
  2. :: 使用系统默认编码而不是强制 UTF-8
  3. setlocal enabledelayedexpansion
  4. echo ==========================================
  5. echo TrendRadar MCP Setup (Windows)
  6. echo ==========================================
  7. echo:
  8. REM Get current directory
  9. set "PROJECT_ROOT=%CD%"
  10. echo Project Directory: %PROJECT_ROOT%
  11. echo:
  12. REM Check Python
  13. echo Checking Python...
  14. python --version >nul 2>&1
  15. if %errorlevel% neq 0 (
  16. echo [ERROR] Python not detected. Please install Python 3.10+
  17. echo Download: https://www.python.org/downloads/
  18. pause
  19. exit /b 1
  20. )
  21. echo Python OK
  22. echo:
  23. REM Check UV
  24. echo Checking UV...
  25. where uv >nul 2>&1
  26. if %errorlevel% neq 0 (
  27. echo [1/3] UV not installed, installing automatically...
  28. echo:
  29. REM Use Bypass execution policy
  30. powershell -ExecutionPolicy Bypass -Command "irm https://astral.sh/uv/install.ps1 | iex"
  31. if %errorlevel% neq 0 (
  32. echo [ERROR] UV installation failed
  33. echo:
  34. echo Please install UV manually:
  35. echo Method 1: Visit https://docs.astral.sh/uv/getting-started/installation/
  36. echo Method 2: Use pip install uv
  37. pause
  38. exit /b 1
  39. )
  40. echo:
  41. echo [SUCCESS] UV installed successfully
  42. echo [IMPORTANT] Please follow these steps:
  43. echo 1. Close this window
  44. echo 2. Reopen Command Prompt or PowerShell
  45. echo 3. Navigate to project directory: cd "%PROJECT_ROOT%"
  46. echo 4. Run this script again: setup-windows.bat
  47. echo:
  48. pause
  49. exit /b 0
  50. ) else (
  51. echo [1/3] UV already installed
  52. uv --version
  53. )
  54. echo:
  55. echo [2/3] Installing project dependencies...
  56. echo:
  57. REM Install dependencies with UV
  58. uv sync
  59. if %errorlevel% neq 0 (
  60. echo [ERROR] Dependency installation failed
  61. echo:
  62. echo Possible causes:
  63. echo - Missing pyproject.toml file
  64. echo - Network connection issues
  65. echo - Incompatible Python version
  66. pause
  67. exit /b 1
  68. )
  69. echo:
  70. echo [3/3] Checking configuration file...
  71. if not exist "config\config.yaml" (
  72. echo [WARNING] Configuration file not found: config\config.yaml
  73. if exist "config\config.example.yaml" (
  74. echo Tip: Example config found, please copy and modify:
  75. echo copy config\config.example.yaml config\config.yaml
  76. )
  77. echo:
  78. )
  79. REM Get UV path
  80. for /f "tokens=*" %%i in ('where uv 2^>nul') do set "UV_PATH=%%i"
  81. if not defined UV_PATH (
  82. echo [WARNING] Unable to get UV path, please find it manually
  83. set "UV_PATH=uv"
  84. )
  85. echo:
  86. echo ==========================================
  87. echo Setup Complete!
  88. echo ==========================================
  89. echo:
  90. echo MCP Server Configuration:
  91. echo:
  92. echo Command: %UV_PATH%
  93. echo Working Directory: %PROJECT_ROOT%
  94. echo:
  95. echo Arguments (one per line):
  96. echo --directory
  97. echo %PROJECT_ROOT%
  98. echo run
  99. echo python
  100. echo -m
  101. echo mcp_server.server
  102. echo:
  103. echo Documentation: README-Cherry-Studio.md
  104. echo:
  105. pause