08_17-AirCARE/bigwork/uv_start.ps1
Your Name bd5d8d108c feat: 添加航空公司情感分析与智能客服系统初始代码
- 实现数据预处理模块(data.py)和模型训练模块(train.py)
- 添加智能客服Agent应用(agent_app.py)和DNA解码系统(dna_decoder.py)
- 包含补偿推荐系统(compensation_recommender.py)和可视化支持
- 添加项目配置文件(pyproject.toml)和README文档
- 提供多种启动脚本(start_app.*, fix_path_and_run.bat等)
2026-01-13 00:43:15 +08:00

58 lines
2.0 KiB
PowerShell

# UV 智能启动脚本 - 自动修复 PATH 并启动应用
Write-Host "🚀 UV 智能启动脚本" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
# 自动修复 PATH 环境变量
function Fix-Path-Auto {
Write-Host "🔧 检查并修复 PATH 环境变量..." -ForegroundColor Yellow
$pythonScriptsPath = "C:\Users\马艺洁\AppData\Local\Programs\Python\Python312\Scripts"
# 检查是否需要修复
$needsFix = $false
if (-not ($env:PATH -like "*$pythonScriptsPath*")) {
Write-Host "✅ 添加正确的 Python Scripts 路径" -ForegroundColor Green
$env:PATH = "$pythonScriptsPath;" + $env:PATH
$needsFix = $true
}
if ($env:PATH -like "*C:;Users*") {
Write-Host "✅ 修复 C:;Users 格式错误" -ForegroundColor Green
$env:PATH = $env:PATH.Replace('C:;Users', 'C:\Users')
$needsFix = $true
}
if ($env:PATH -like "*;%S;stemRoot%*") {
Write-Host "✅ 修复 ;%S;stemRoot% 格式错误" -ForegroundColor Green
$env:PATH = $env:PATH.Replace(';%S;stemRoot%', ';%SystemRoot%')
$needsFix = $true
}
if (-not $needsFix) {
Write-Host "✅ PATH 环境变量正常" -ForegroundColor Green
}
}
# 执行修复
Fix-Path-Auto
# 切换到项目目录
Set-Location "d:\HuaweiMoveData\Users\马艺洁\Desktop\MLwork\bigwork"
# 验证 UV 命令
Write-Host "🔍 验证 UV 命令可用性..." -ForegroundColor Cyan
try {
$uvVersion = uv --version 2>$null
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ UV 命令可用: $uvVersion" -ForegroundColor Green
Write-Host "🚀 使用 UV 启动 Streamlit 应用..." -ForegroundColor Green
uv run streamlit run src/streamlit_app.py
} else {
throw "UV command failed"
}
} catch {
Write-Host "⚠️ UV 命令不可用,尝试使用 python -m uv..." -ForegroundColor Yellow
python -m uv run streamlit run src/streamlit_app.py
}