創建一個setup.py,然後運行python setup.py py2exe即可
# -*- coding: utf-8 -*-
from distutils.core import setup
import glob
import py2exe
includes = ["encodings", "encodings.*","sip","PyQt4.QtCore",
"PyQt4.QtGui","codecs","codecs.*"]
options = {"py2exe":
{ "compressed": 1,
"optimize": 2,
"includes": includes,
#"bundle_files": 1
}
}
setup(
version = "0.1.0",
description = "hello",
name = "hello",
options=options,
#zipfile=None,
console=[{"script": "hello.py", "icon_resources": [(1, "yahoo.ico")]}],
)
setup(
version = "0.1.0",
description = "editor",
name = "editor",
options=options,
data_files=[("images",glob.glob("images\\*.*"))],
#zipfile=None,
windows=[{"script": "start.py", "icon_resources": [(1, "yahoo.ico")]}],
)