【1】安装pyinstaller
pip install pyinstaller
pip3 install pyinstaller
【2】查看版本
pyinstaller –version
【3】跳转到根目录
X:
【4】跳转到需要打包的文件夹
cd X:\要打包的文件夹
【5】打包exe
pyinstaller -F 要打包的程序.py
成功提示:
9696 INFO: Building EXE from EXE-00.toc completed successfully.
【6】生成的exe位置
X:\要打包的文件夹\dist\要打包的程序.exe
坑:
1.【报错】
‘pyinstaller’ 不是内部或外部命令,也不是可运行的程序
【解决】
python3.8在安装pyinstaller时不会自动添加系统路径,需要手动添加
C:\Users\XXX\AppData\Roaming\Python\Python38\Scripts
添加到【环境变量】-【系统变量】-【Path】
Python打包exe