Files
CM95/scripts/repair_env.ps1
2026-09-02 09:50:12 +08:00

24 lines
631 B
PowerShell

$ErrorActionPreference = "Stop"
$Python312 = (pyenv which python | Select-Object -First 1).Trim()
if (-not (Test-Path $Python312)) {
throw "找不到 pyenv Python: $Python312"
}
$Version = (& $Python312 --version 2>&1).Trim()
if ($Version -ne "Python 3.12.10") {
throw "pyenv 当前不是 Python 3.12.10: $Version"
}
if (Test-Path ".venv") {
Remove-Item -Recurse -Force ".venv"
}
& $Python312 -m venv .venv
$VenvPython = (Resolve-Path ".\.venv\Scripts\python.exe").Path
& $VenvPython -m pip install --upgrade pip
& $VenvPython -m pip install -e .
& ".\.venv\Scripts\cm93db.exe" --help
Write-Host "修复完成。"