您的位置:首页 > 编程语言 > Python开发

[Python]实现Python脚本转EXE

2017-04-12 19:38 183 查看

构建环境

C:\Python27\Tools\pyinstaller>python -V
Python 2.7.10
C:\Python27\Tools\pyinstaller>pip install pypiwin32
C:\Python27\Tools\pyinstaller>pip install pyinstaller




转换命令

C:\Tools\>pyinstaller -F helloworld.py
240 INFO: PyInstaller: 3.2.1
240 INFO: Python: 2.7.10
240 INFO: Platform: Windows-7-6.1.7601-SP1
...
248 INFO: Initializing module dependency graph...
250 INFO: Initializing module graph hooks...
...
3853 INFO: Building EXE from out00-EXE.toc completed successfully.

C:\Tools\>tree /f
Folder PATH listing
Volume serial number is 00000200 6E5E:00DE
C:.
│  helloworld.py
│  helloworld.spec
│
├─build
│  └─helloworld
│          helloworld.exe.manifest
│          out00-Analysis.toc
│          out00-EXE.toc
│          out00-PKG.pkg
│          out00-PKG.toc
│          out00-PYZ.pyz
│          out00-PYZ.toc
│          warnhelloworld.txt
│
└─dist
helloworld.exe


小结

查阅网上资料,初步确定了py2exe和pyinstaller,由于py2exe开发已经停滞在2008年,所以果断选择pyinstaller。目前的命令已经满足博主的需求,以后有需要再深入研究吧

参考

知乎:python3.4写好的.py文件如何打包成exe?

用Py2exe打包Python脚本简单介绍
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: