使用Pyinstaller对.py程序打包成.exe
pyinstaller3.2
python2.7
windows环境下安装pyinstaller3.2 :
先安装pywin32-217.win32-py2.7.exe;
解压pyinstaller3.2 后直接可以执行:
python pyinstaller.py -F -w C:\mypy\mypy.py
python pyinstaller.py -F ./cp/image.py
-F: 单文件
-w: 不显示控制台
添加upx
把upx.exe 放在PyInstaller-3.0 目录下即可。程序默认使用upx 方式生成exe。
出现错误:ImportError: No module named ‘pefile’
原因分析:(Windows) No longer bundle pefile, use package from for windows (#1357)
解决方法:
1.[use new pefile release with built-in Python 3 support](https://github.com/pyinstaller/pyinstaller/issues/1357)
2. 使用pyinstaller3.0版本