改用 --onedir 编译模式,降低杀软误报

This commit is contained in:
2026-07-31 13:08:30 +08:00
parent 971764c47d
commit 31d31edd62
+4 -4
View File
@@ -4,8 +4,8 @@
.SYNOPSIS .SYNOPSIS
壁纸更换器 - 编译脚本 壁纸更换器 - 编译脚本
.DESCRIPTION .DESCRIPTION
使用 PyInstaller 将 Python 源码打包为单个 .exe 文件 使用 PyInstaller 将 Python 源码打包为目录模式(--onedir
输出: .\dist\WallpaperChanger.exe 输出: .\dist\WallpaperChanger\WallpaperChanger.exe
#> #>
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
@@ -34,7 +34,7 @@ Remove-Item -Force "$ScriptDir\*.spec" -ErrorAction SilentlyContinue
Write-Host "[4/4] PyInstaller 打包 ..." -ForegroundColor Yellow Write-Host "[4/4] PyInstaller 打包 ..." -ForegroundColor Yellow
Set-Location -LiteralPath $ScriptDir Set-Location -LiteralPath $ScriptDir
python -m PyInstaller ` python -m PyInstaller `
--onefile ` --onedir `
--noconsole ` --noconsole `
--name "WallpaperChanger" ` --name "WallpaperChanger" `
--clean ` --clean `
@@ -45,5 +45,5 @@ if ($LASTEXITCODE -ne 0) { throw "PyInstaller 打包失败" }
Write-Host "" Write-Host ""
Write-Host "========================================" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Green
Write-Host " 编译完成!" -ForegroundColor Green Write-Host " 编译完成!" -ForegroundColor Green
Write-Host " 输出: $ScriptDir\dist\WallpaperChanger.exe" -ForegroundColor Green Write-Host " 输出: $ScriptDir\dist\WallpaperChanger\WallpaperChanger.exe" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green Write-Host "========================================" -ForegroundColor Green