1
This commit is contained in:
1 parent
2ea1a79bda
commit
85425483c0
50 files changed
+6468
-1854
No files matched your search
@@ -15,8 +15,11 @@ $VenvPyw = Join-Path $Dir ".venv\Scripts\pythonw.exe"
|
||||
function Find-Python {
|
||||
foreach ($v in "3.13", "3.12", "3.11", "3.10") {
|
||||
try {
|
||||
$exe = & py "-$v" -c "import sys; print(sys.executable)" 2>$null
|
||||
if ($LASTEXITCODE -eq 0 -and $exe) { return $exe.Trim() }
|
||||
$exe = & py "-$v" -c "import sys, json; print(json.dumps(sys.executable, ensure_ascii=True))" 2>$null
|
||||
if ($LASTEXITCODE -eq 0 -and $exe) {
|
||||
$path = $exe | ConvertFrom-Json
|
||||
if (Test-Path -LiteralPath $path -PathType Leaf) { return $path }
|
||||
}
|
||||
} catch {}
|
||||
}
|
||||
foreach ($d in "Python313", "Python312", "Python311", "Python310") {
|
||||
@@ -24,8 +27,11 @@ function Find-Python {
|
||||
if (Test-Path $p) { return $p }
|
||||
}
|
||||
try {
|
||||
$exe = & python -c "import sys; assert sys.version_info >= (3, 10); print(sys.executable)" 2>$null
|
||||
if ($LASTEXITCODE -eq 0 -and $exe) { return $exe.Trim() }
|
||||
$exe = & python -c "import sys, json; assert sys.version_info >= (3, 10); print(json.dumps(sys.executable, ensure_ascii=True))" 2>$null
|
||||
if ($LASTEXITCODE -eq 0 -and $exe) {
|
||||
$path = $exe | ConvertFrom-Json
|
||||
if (Test-Path -LiteralPath $path -PathType Leaf) { return $path }
|
||||
}
|
||||
} catch {}
|
||||
return $null
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user