文、意如
打包成.exe檔流程
步驟 1:安裝 PyInstaller(只需一次)
打開終端機(或 Anaconda Prompt)輸入:
指令:pip install pyinstaller

步驟 2:進入你的程式所在資料夾
假設你的 Python 檔名叫 face_mosaic.py,你先進入該資料夾:
cd 路徑\到\你的\檔案資料夾
例如:
cd C:\Users\YourName\Desktop\project
步驟3:打包
pyinstaller --onefile --windowed py08.py
--onefile:打包成單一 .exe 檔
--noconsole:隱藏命令列視窗(如果是 GUI 程式)
如果你有用 tkinter、PyQt 或 filedialog 等圖形介面,才建議用 --noconsole
如果你需要顯示 print() 訊息給除錯用,建議不要加這個
步驟 4:找到 .exe
檔
打包後,會在 dist
資料夾產生 face_mosaic.exe
:
複製編輯
your_project/
├── face_mosaic.py
├── dist/
│ └── face_mosaic.exe ✅ ← 這就是執行檔

Yiru@Studio - 關於我 - 意如