$ErrorActionPreference = "Stop" $Root = Split-Path -Parent $PSScriptRoot $Venv = Join-Path $Root ".venv" $Python = "python" if (-not (Test-Path $Venv)) { & $Python -m venv $Venv } $VenvPython = Join-Path $Venv "Scripts\python.exe" $WheelDir = Join-Path $Root "vendor\wheels" $Req = Join-Path $Root "requirements.txt" if (-not (Test-Path $WheelDir)) { throw "未找到离线依赖目录:$WheelDir。请先在联网环境运行 scripts\download_wheels.ps1。" } & $VenvPython -m pip install --no-index --find-links $WheelDir -r $Req Write-Host "安装完成。运行 scripts\run.ps1 启动服务。"