1.下载cxfreeze,或者通过pycharm下载
2.配置打包文件
import sys
from cx_Freeze import setup, Executable
# Dependencies are automatically detected, but it might need fine tuning.
build_exe_options = {"packages": ["os"]}
# 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 = "guifoo",
version = "0.1",
description = "My GUI application!",
options = {"build_exe": build_exe_options},
executables = [Executable("C:\Users\wqjzz\PycharmProjects\untitled4\weikuangku\SendServices.py", base=base)])
命名为setup.py
放到项目的当前文件夹
3.执行命令:python setup.py build
即生成了exe文件
注:
出现
ImportError: No module named _mssql,打开exe时出现这样的错误时,显式调用下
import _mssql