# VisioFirm 一键启动脚本 Write-Host "========================================" -ForegroundColor Cyan Write-Host " 正在启动 VisioFirm..." -ForegroundColor Cyan Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # 设置 UTF-8 环境变量(解决 Windows 中文环境编码问题) $env:PYTHONUTF8 = 1 Write-Host "[1/4] 已设置 PYTHONUTF8=1" -ForegroundColor Green # 检查 Conda 是否可用 try { $condaVersion = conda --version 2>&1 Write-Host "[2/4] Conda 已检测到: $condaVersion" -ForegroundColor Green } catch { Write-Host "[错误] 未检测到 Conda,请先安装 Anaconda 或 Miniconda" -ForegroundColor Red Read-Host "按任意键退出" exit 1 } # 激活 Conda 环境 Write-Host "[3/4] 正在激活 Conda 环境 (yolo_demo)..." -ForegroundColor Green conda activate yolo_demo if ($LASTEXITCODE -ne 0) { Write-Host "[警告] 激活环境时可能存在问题,但将继续尝试..." -ForegroundColor Yellow } # 检查 VisioFirm 是否已安装 try { $visiofirmInstalled = python -c "import visiofirm; print('OK')" 2>&1 if ($visiofirmInstalled -eq 'OK') { Write-Host "[4/4] VisioFirm 已安装" -ForegroundColor Green } } catch { Write-Host "[提示] 正在尝试安装 VisioFirm..." -ForegroundColor Yellow pip install visiofirm } Write-Host "" Write-Host "🎉 VisioFirm 即将启动!" -ForegroundColor Yellow Write-Host "📱 请在浏览器中打开: http://localhost:8000" -ForegroundColor Yellow Write-Host "" Write-Host "按 Ctrl+C 停止服务器" -ForegroundColor Gray Write-Host "" Write-Host "========================================" -ForegroundColor Cyan Write-Host "" # 启动 VisioFirm visiofirm