把python脚本编译成exe
目前有三种方法
[TOC]
pyinstaller
下载地址
最近更新时间2013-09-28
官网:http://www.pyinstaller.org/
github: https://github.com/pyinstaller/pyinstaller
支持版本
2.4 - 2.7
使用方法
python pyinstaller.py [opts] yourprogram.py
主要选项包括:
-F, –onefile 打包成一个exe文件。
-D, –onedir 创建一个目录,包含exe文件,但会依赖很多文件(默认选项)。
-c, –console, –nowindowed 使用控制台,无界面(默认)
-w, –windowed, –noconsole 使用窗口,无控制台
py2exe
下载地址
最近更新时间2008-11-16
官网:http://www.py2exe.org/
支持版本
使用方法
新建一个setup.py,内容如下(target.py就是你将要编译的文件)
from distutils.core import setup
import py2exe
setup(console=["target.py"])- 执行python setup.py py2exe
- dist文件夹里就是你需要的exe
帮助命令 python setup.py py2exe --help
cx_Freeze
下载地址
最近更新时间2014-05-04
官网:http://sourceforge.net/projects/cx-freeze/
支持版本
2.4-2.7
使用方法
查看帮助:cxfreeze -h
打包命令 cxfreeze target.py --target-dir dist