单个py文件打包成exe:
1.找到python中包含 pip.exe的目录,运行cmd,安装Pyinstaller,语句如下:
pip.exe intall Pyinstaller
2.安装成功后使用Pyinstaller,cmd命令如下:
pyinstaller.exe -F D:\目录XX\xx.py
命令执行结束后会在当前目录下生成dist文件夹,里面就是我们想要的exe文件了。
多个py文件打包成exe:
pyinstaller -F F:\four_arithmetic_operation\deal.py -p F:\four_arithmetic_operation\deal_ui.py --hidden-import deal_ui --noconsole
第一个文件路径为主文件,后面的为附属文件,–noconsole表示运行exe时不展示cmd窗口(注意是 两个-)。
同样也是在dist文件夹中有我们想要的exe文件。
后续发现可以设定自己的图标的方法,再回来记录。