python使用cxfreeze打包

来源:互联网 发布:湖南机电职院网络 编辑:程序博客网 时间:2024/06/05 17:36

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


0 0