Python3.x 将Python项目打包成 .exe可执行文件
2020-08-29 本文已影响0人
行走的风_75e2
1.安装pyinstaller
打开windows命令行模式》进入Python安装目录下的Scripts文件下》执行pip3 install pyinstaller



2.将要打包的python文件复制到当前目录下

3.执行命令
pyinstaller.exe -F gupiao.py


在dist目录下即可找到刚才打包好的文件

打包后的文件可直接双击运行,且不依赖外部环境,因为打包的时候把python环境也打包进去了。
双击运行完成后会自动关闭弹窗,所以要打包测试的python文件最好有明显的效果或者多在代码里打印一些数据,不然会自己怀疑没打好(我当时就是这么经历的)
