feat: 新增模块化Streamlit本地工具箱
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
$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
|
||||
Reference in New Issue
Block a user