Python编译成可执行文件exe等

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('''

==========================  
|                       |  
|                       |  
|                       |  
|       Welcome         |  
|                       |  
|                       |  
|                       |  
==========================  
      
''')

input("input") 
PythonApplication1.py
from cx_Freeze import setup, Executable  


setup(name='test to exe',
      version = '0.1',  
      description='test from py file to exe file', 
      executables = [Executable("demo.py")])
运行python PythonApplication1.py build,生产一堆文件,其中有exe可执行文件
PythonApplication1\PythonApplication1\build\exe.win-amd64-3.5

你可能感兴趣的:(Python)