Initial Linux Qt OpenCV project

This commit is contained in:
luochen570
2026-05-29 22:29:30 +08:00
commit 81d586c032
22 changed files with 1748 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
param(
[string]$PythonBin = "$PSScriptRoot\..\tools\python-bin",
[string]$VenvDir = "$PSScriptRoot\..\tools\python-venv"
)
$ErrorActionPreference = "Stop"
$PythonBin = [System.IO.Path]::GetFullPath($PythonBin)
$VenvDir = [System.IO.Path]::GetFullPath($VenvDir)
$PythonExe = Join-Path $PythonBin "python.exe"
if (!(Test-Path $PythonExe)) {
throw "未找到项目内 Python 二进制:$PythonExe"
}
# Windows embeddable Python 不一定带 venv 模块。优先尝试 venv失败则使用同目录作为隔离 Python 环境安装 pip。
try {
& $PythonExe -m venv $VenvDir
$VenvPython = Join-Path $VenvDir "Scripts\python.exe"
& $VenvPython -m pip install --upgrade pip setuptools wheel
& $VenvPython -m pip install aqtinstall
Write-Host "已创建虚拟环境:$VenvDir"
} catch {
Write-Warning "venv 创建失败,改用项目内 embeddable Python 自身作为隔离环境。"
& $PythonExe (Join-Path $PythonBin "get-pip.py")
& $PythonExe -m pip install --upgrade pip setuptools wheel
& $PythonExe -m pip install aqtinstall
Write-Host "已在项目内 Python 二进制目录安装 pip/aqtinstall$PythonBin"
}