22 lines
928 B
PowerShell
22 lines
928 B
PowerShell
$ErrorActionPreference = 'Stop'
|
|
Set-Location -LiteralPath $PSScriptRoot
|
|
$env:PYTHONIOENCODING = 'utf-8'
|
|
if (Get-Command uv -ErrorAction SilentlyContinue) {
|
|
if (-not (Test-Path '.venv-ui/Scripts/python.exe')) {
|
|
uv venv .venv-ui --python 3.13
|
|
if ($LASTEXITCODE -ne 0) { throw '创建 Python 环境失败。' }
|
|
}
|
|
uv pip install --python .venv-ui/Scripts/python.exe -r requirements-ui.txt
|
|
if ($LASTEXITCODE -ne 0) { throw '安装依赖失败。' }
|
|
& .venv-ui/Scripts/python.exe -m streamlit run app.py
|
|
} else {
|
|
if (-not (Test-Path '.venv-ui/Scripts/python.exe')) {
|
|
python -m venv .venv-ui
|
|
if ($LASTEXITCODE -ne 0) { throw '创建 Python 环境失败。' }
|
|
}
|
|
& .venv-ui/Scripts/python.exe -m pip install -r requirements-ui.txt
|
|
if ($LASTEXITCODE -ne 0) { throw '安装依赖失败。' }
|
|
& .venv-ui/Scripts/python.exe -m streamlit run app.py
|
|
}
|
|
exit $LASTEXITCODE
|