python生成安裝文件 msi
- 2020 年 1 月 13 日
- 筆記
①.需要在目錄下面創建一個文件 。setup.py
②.寫入程式碼:
import sys from cx_Freeze import setup, Executable import os os.environ['TCL_LIBRARY'] = r'C:Python36-32tcltcl8.6' os.environ['TK_LIBRARY'] = r'C:Python36-32tcltk8.6' include_files=[ r'C:Python36-32DLLstcl86t.dll', r'C:Python36-32DLLstk86t.dll' ] # Dependencies are automatically detected, but it might need fine tuning. build_exe_options = {"packages": ["os"], "excludes": ["tkinter"],"include_files":include_files} # 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="video1",#打完包後取的名字 version="2.1",#版本 description="aaaaa",#描述 options={"build_exe": build_exe_options}, executables=[Executable("video.py", base=base)])
③.命令:
python setup.py bdist_msi 生成安裝包以及直接運行的exe文件
python setup.py build 生成exe可執行程式