好用的py2exe的setup.py脚本
2017-08-29 11:47
197 查看
# -*- coding: utf-8 -*-
from distutils.core import setup
import py2exe
import sys
#old style
#setup(console=["D:\python34\py2exe_test\helloworld.py"])
#new style
py2exe_options = {
#"includes": ["sip"],#If Qt Aplication,you need to add this line
"dll_excludes": ["MSVCP90.dll",], #miss these dll files
"compressed": 1,
#optimize:
#0 - don’t optimize (generate .pyc)
#1 - normal optimization (like python -O)
#2 - extra optimization (like python -OO)
"optimize": 2,
"ascii": 0,
#bundle_files:
#3 - create script.exe, python.dll, extensions.pyd, others.dll.
#2 - create script.exe, python.dll, others.dll.
#1 - create script.exe, others.dll.
#0 - create script.exe.
"bundle_files": 3,
}
setup(
name = 'Python_gui',
version = '1.0',
#If GUI ,use windows;else use console
windows = ['my_tool.py',],
#console = ['my_tool.py',],
zipfile = None,
#None : Not generate Zip file,and generate in exe file
options = {'py2exe': py2exe_options}
)
使用上面的setup.py
并使用cmd进入需要转化为exe的py脚本所在目录
执行如下命令,生成exe:python setup.py py2exe
from distutils.core import setup
import py2exe
import sys
#old style
#setup(console=["D:\python34\py2exe_test\helloworld.py"])
#new style
py2exe_options = {
#"includes": ["sip"],#If Qt Aplication,you need to add this line
"dll_excludes": ["MSVCP90.dll",], #miss these dll files
"compressed": 1,
#optimize:
#0 - don’t optimize (generate .pyc)
#1 - normal optimization (like python -O)
#2 - extra optimization (like python -OO)
"optimize": 2,
"ascii": 0,
#bundle_files:
#3 - create script.exe, python.dll, extensions.pyd, others.dll.
#2 - create script.exe, python.dll, others.dll.
#1 - create script.exe, others.dll.
#0 - create script.exe.
"bundle_files": 3,
}
setup(
name = 'Python_gui',
version = '1.0',
#If GUI ,use windows;else use console
windows = ['my_tool.py',],
#console = ['my_tool.py',],
zipfile = None,
#None : Not generate Zip file,and generate in exe file
options = {'py2exe': py2exe_options}
)
使用上面的setup.py
并使用cmd进入需要转化为exe的py脚本所在目录
执行如下命令,生成exe:python setup.py py2exe
相关文章推荐
- python3.4下使用py2exe将py脚本打包为exe
- 关于py2exe的setup.py的部分释疑
- 如何利用Python2.7、py2exe、PyInstaller-2.1将*.py打包成*.exe,再利用Inno Setup Compiler封装成windows安装文件
- py2exe 2.7 将引用matplotlib库的程序转成exe的setup.py 的编写
- windows下为Python脚本生成单独可执行程序的脚本(不用为每个脚本写setup.py了)
- Setup Factory 脚本编辑方法
- create_project.py脚本将新建的工程 Cocos2d-x
- Python setup.py和MANIFEST.in文件
- Inno Setup入门(十二)——Pascal脚本(1)
- py脚本得到Python的版本
- 如何卸载Python通过setup.py安装的模块
- TensorFlow下MNIST数据集下载脚本input_data.py
- py2exe打包python脚本
- python的setup.py文件
- 用py2exe将py文件打包成exe程序
- python包管理(distutils、easy_install、pip、setup.py/requirements.txt、wheel)
- Command python setup.py egg_info failed with error code 1
- Python 操作excel 安装xlrd,双击setup.py无效解决办法
- python 使用 setup.py 方式安装及包的卸载
- python写setup.py install 文件