确定python版本,3.7以下 2.7以上
1.pip install pyinstaller
2.安装完去当前使用的python版本目录的 script目录,这里面有pyinstaller模块
3.把py文件或者 pyx文件放到这个目录
4.打开cmd 执行 pyinstaller -F -w xxx.py
5.执行完会出来个dict文件夹,exe文件在里面
注意:
1.如果需要不显示cmd窗口 加-w参数
2.指定打包加一个小图标使用 pyinstaller -F -i xx.ico xxx.py
3.如果打出需要打开cmd窗口,不想关闭的可以在代码中加一个input() #等待用户输入