一、安装pyinstaller
pip install pyinstaller

二、打包制定py文件
D:\py_space>pyinstaller -F -w test.py
双击红色方框里的.exe即可

三、
pyinstaller 指令解释:
-F 将py文件打包为可执行文件
-w 打包后文件执行不展示命令行窗口
-c 打包后文件执行展示命令行窗口
指定打包后exe文件的位置:
上面的打包语句加上另一个参数 --distpath=exe文件存放位置
D:\py_space>pyinstaller -F -w test.py --distpath=D:\py_space