python可编译成针对操作系统的可执行文件,
- cx_Freeze for Windows, Linux, and Mac OS X (Python 2.7, 3.x)
- pyinstaller for Windows, Linux, and Mac OS X (Python 2.7, 3.3-3.5)
- bbfreeze for Windows and Linux (Python 2.4-2.7)
- py2exe for Windows (Python 2.6, 2.7)
- py2exe for Windows (Python 3.3-3.5)
- Freeze for Linux and maybe Mac OS X (Python 2.x)
- py2app for Mac OS X (Python 2.x)
安装cx_Freeze工具
python -m pip install cx_Freeze --upgrade
编写2个python文件
demo.py
print('''PythonApplication1.py
==========================
| |
| |
| |
| Welcome |
| |
| |
| |
==========================
''')
input("input")
from cx_Freeze import setup, Executable运行python PythonApplication1.py build,生产一堆文件,其中有exe可执行文件
setup(name='test to exe',
version = '0.1',
description='test from py file to exe file',
executables = [Executable("demo.py")])
PythonApplication1\PythonApplication1\build\exe.win-amd64-3.5