打包python到exe

#!/usr/bin/python
# -*- coding:utf-8 -*-

import distutils
import py2exe
from distutils.core import setup
options = {
    # "py2exe": {"packages": ['wx.lib.pubsub'], "includes": ["sip"]}
    # "py2exe": {"includes": ["sip"]}
}
distutils.core.setup(windows=[{"script": "codata_chrome.py", "icon_resources": [(1, "logo.ico")]}], options=options,version="1.0.0", author='jiangjh5', author_email='jiangjh5@xxxxxx.com')

先上代码示例,简单的打包python到exe很简单,几行代码。

1.首先得先安装python的py2exe包

pip install py2exe

2.创建python打包文件(package_python.py)如上示例

3.在系统命令行中执行

python package_python.py py2exe

4.在同一目录下的dist文件中就是生成的exe文件及其调用的库和文件

 

posted @ 2017-07-20 09:04  清风@_@  阅读(250)  评论(0编辑  收藏  举报