1 Star 0 Fork 0

linght/pythonCode

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
Clone or Download
build.ps1 1.11 KB
Copy Edit Raw Blame History
linght authored 2025-07-01 22:07 +08:00 . pythonAPp
$exeName = "linghtApp.exe"
$mainScript = "main.py"
$buildDistDir = "build/exe"
$buildWorkDir = "build/tmp"
$specFile = "build/spec"
Write-Host "Checking for running EXE: $exeName..."
try {
$proc = Get-Process | Where-Object { $_.Name -eq [System.IO.Path]::GetFileNameWithoutExtension($exeName) }
if ($proc) {
Stop-Process -Name $proc.Name -Force
Start-Sleep -Seconds 1
Write-Host "Killed process $($proc.Name)"
} else {
Write-Host "No running process found."
}
} catch {
Write-Warning "Failed to stop process: $_"
}
Write-Host "Cleaning old build files..."
Remove-Item $buildDistDir -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $buildWorkDir -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item $specFile -Force -ErrorAction SilentlyContinue
Write-Host "Building executable to $buildDir..."
python -m PyInstaller `
--onefile `
--name ([System.IO.Path]::GetFileNameWithoutExtension($exeName)) `
--distpath $buildDistDir `
--workpath $buildWorkDir `
--specpath $specFile `
$mainScript
Write-Host "Build completed! EXE located at $buildDir\$exeName"
pause
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/linght/python-code.git
git@gitee.com:linght/python-code.git
linght
python-code
pythonCode
master

Search