fix: 脚本安装问题

This commit is contained in:
sansan 2025-11-07 13:26:18 +08:00
parent 7d3c05aa03
commit e04459f33e
2 changed files with 26 additions and 22 deletions

View File

@ -47,7 +47,7 @@
- 感谢**关注[公众号](#问题答疑与1元点赞)** 的读者们,你们的留言、点赞、分享和推荐等积极互动让内容更有温度😎。 - 感谢**关注[公众号](#问题答疑与1元点赞)** 的读者们,你们的留言、点赞、分享和推荐等积极互动让内容更有温度😎。
<details> <details>
<summary>👉 点击查看<strong>致谢名单</strong> (当前 <strong>🔥44🔥</strong> 位)</summary> <summary>👉 点击查看<strong>致谢名单</strong> (当前 <strong>🔥45🔥</strong> 位)</summary>
### 数据支持 ### 数据支持
@ -67,6 +67,7 @@
| 点赞人 | 金额 | 日期 | 备注 | | 点赞人 | 金额 | 日期 | 备注 |
| :-------------------------: | :----: | :----: | :-----------------------: | | :-------------------------: | :----: | :----: | :-----------------------: |
| Q*Q | 6.66 | 2025.11.07 | 感谢开源! |
| C*e | 1 | 2025.11.05 | | | C*e | 1 | 2025.11.05 | |
| Peter Fan | 20 | 2025.10.29 | | | Peter Fan | 20 | 2025.10.29 | |
| M*n | 1 | 2025.10.27 | 感谢开源 | | M*n | 1 | 2025.10.27 | 感谢开源 |

View File

@ -1,17 +1,19 @@
@echo off @echo off
chcp 65001 >nul :: 使用系统默认编码而不是强制 UTF-8
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
echo ========================================== echo ==========================================
echo TrendRadar MCP Setup (Windows) echo TrendRadar MCP Setup (Windows)
echo ========================================== echo ==========================================
echo. echo:
REM Get current directory REM Get current directory
set "PROJECT_ROOT=%CD%" set "PROJECT_ROOT=%CD%"
echo Project Directory: %PROJECT_ROOT% echo Project Directory: %PROJECT_ROOT%
echo. echo:
REM Check Python REM Check Python
echo Checking Python...
python --version >nul 2>&1 python --version >nul 2>&1
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
echo [ERROR] Python not detected. Please install Python 3.10+ echo [ERROR] Python not detected. Please install Python 3.10+
@ -19,19 +21,22 @@ if %errorlevel% neq 0 (
pause pause
exit /b 1 exit /b 1
) )
echo Python OK
echo:
REM Check UV REM Check UV
echo Checking UV...
where uv >nul 2>&1 where uv >nul 2>&1
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
echo [1/3] UV not installed, installing automatically... echo [1/3] UV not installed, installing automatically...
echo. echo:
REM Use Bypass execution policy REM Use Bypass execution policy
powershell -ExecutionPolicy Bypass -Command "irm https://astral.sh/uv/install.ps1 | iex" powershell -ExecutionPolicy Bypass -Command "irm https://astral.sh/uv/install.ps1 | iex"
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
echo [ERROR] UV installation failed echo [ERROR] UV installation failed
echo. echo:
echo Please install UV manually: echo Please install UV manually:
echo Method 1: Visit https://docs.astral.sh/uv/getting-started/installation/ echo Method 1: Visit https://docs.astral.sh/uv/getting-started/installation/
echo Method 2: Use pip install uv echo Method 2: Use pip install uv
@ -39,30 +44,30 @@ if %errorlevel% neq 0 (
exit /b 1 exit /b 1
) )
echo. echo:
echo [SUCCESS] UV installed successfully echo [SUCCESS] UV installed successfully
echo [IMPORTANT] Please follow these steps: echo [IMPORTANT] Please follow these steps:
echo 1. Close this window echo 1. Close this window
echo 2. Reopen Command Prompt (or PowerShell) echo 2. Reopen Command Prompt or PowerShell
echo 3. Navigate to project directory: cd "%PROJECT_ROOT%" echo 3. Navigate to project directory: cd "%PROJECT_ROOT%"
echo 4. Run this script again: setup-windows.bat echo 4. Run this script again: setup-windows.bat
echo. echo:
pause pause
exit /b 0 exit /b 0
) else ( ) else (
echo [1/3] UV already installed echo [1/3] UV already installed
uv --version uv --version
) )
echo:
echo.
echo [2/3] Installing project dependencies... echo [2/3] Installing project dependencies...
echo. echo:
REM Install dependencies with UV REM Install dependencies with UV
uv sync uv sync
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
echo [ERROR] Dependency installation failed echo [ERROR] Dependency installation failed
echo. echo:
echo Possible causes: echo Possible causes:
echo - Missing pyproject.toml file echo - Missing pyproject.toml file
echo - Network connection issues echo - Network connection issues
@ -70,37 +75,35 @@ if %errorlevel% neq 0 (
pause pause
exit /b 1 exit /b 1
) )
echo:
echo.
echo [3/3] Checking configuration file... echo [3/3] Checking configuration file...
if not exist "config\config.yaml" ( if not exist "config\config.yaml" (
echo [WARNING] Configuration file not found: config\config.yaml echo [WARNING] Configuration file not found: config\config.yaml
if exist "config\config.example.yaml" ( if exist "config\config.example.yaml" (
echo Tip: Example config found, please copy and modify: echo Tip: Example config found, please copy and modify:
echo copy config\config.example.yaml config\config.yaml echo copy config\config.example.yaml config\config.yaml
) )
echo. echo:
) )
REM Get UV path REM Get UV path
for /f "tokens=*" %%i in ('where uv 2^>nul') do set "UV_PATH=%%i" for /f "tokens=*" %%i in ('where uv 2^>nul') do set "UV_PATH=%%i"
if not defined UV_PATH ( if not defined UV_PATH (
echo [WARNING] Unable to get UV path, please find it manually echo [WARNING] Unable to get UV path, please find it manually
set "UV_PATH=uv" set "UV_PATH=uv"
) )
echo. echo:
echo ========================================== echo ==========================================
echo Setup Complete! echo Setup Complete!
echo ========================================== echo ==========================================
echo. echo:
echo MCP Server Configuration: echo MCP Server Configuration:
echo. echo:
echo Command: %UV_PATH% echo Command: %UV_PATH%
echo Working Directory: %PROJECT_ROOT% echo Working Directory: %PROJECT_ROOT%
echo. echo:
echo Arguments (one per line): echo Arguments (one per line):
echo --directory echo --directory
echo %PROJECT_ROOT% echo %PROJECT_ROOT%
@ -108,7 +111,7 @@ echo run
echo python echo python
echo -m echo -m
echo mcp_server.server echo mcp_server.server
echo. echo:
echo Documentation: README-Cherry-Studio.md echo Documentation: README-Cherry-Studio.md
echo. echo:
pause pause