將專案打包到 excutableinstaller 中
cx_Freeze - 一個工具可以將專案打包到 excutable / installer
- 在通過 pip 安裝後,打包
demo.py
,我們需要setup.py
如下。
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {
"excludes": ["tkinter"],
"include_files":[('./platforms','./platforms')] # need qwindows.dll for qt5 application
}
# GUI applications require a different base on Windows (the default is for a
# console application).
base = None
if sys.platform == "win32":
base = "Win32GUI"
setup( name = "demo",
version = "0.1",
description = "demo",
options = {"build_exe": build_exe_options},
executables = [Executable("demo.py", base=base)])
- 然後建立
python .\setup.py build
- 分開
python .\setup.py bdist_msi