标签:
使用py2exe进行打包
例:
from distutils.core import setup
import py2exe
import sys
sys.argv.append(‘py2exe‘)
py2exe_options = {
#调用的库
"includes": ["sip","pyxmpp","M2Crypto","dns","Skype4Py","libxmlmods","PyQt4",],
"dll_excludes": ["MSVCP90.dll",],
"compressed": 1,
"optimize": 2,
"ascii": 0,
"bundle_files": 1,
}
setup(
name = ‘PyQt Demo‘,
version = ‘1.0‘,
#打包py文件和程序图标
windows = [{‘script‘:‘tunneler_client.py‘,‘icon_resources‘:[(1,"icon.ico")]}],
zipfile = None,
options = {‘py2exe‘: py2exe_options}
)
对py文件打包后很难调试程序,可使用python的logging输出日志文件
logger = logging.getLogger()
logger.addHandler(logging.StreamHandler()) #关闭和开启日志输出
标签:
原文地址:http://www.cnblogs.com/QUSIR/p/4606119.html