安装
一般来说,安装直接
pip install pyinstaller
即可,但是若是某些程序打包出现问题则建议安装开发版
pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip
使用Pyinstaller
打包成一个文件夹
pyinstaller test.py
打包成一个单一的可执行文件
pyinstaller --onefile test.py
默认情况下打包会在当前目录下生成dist和build文件夹以及.spec文件。dist中即打包出来的可执行文件目录,build文件夹下为构建过程临时文件目录,.spec为打包的配置文件。
Python打包exe出现cmd窗口
问题:在使用命令pyinstaller -F xx.py 打包生成exe文件后,双击运行总是出现cmd窗口。
解决方法:把文件名后缀改为.pyw,然后执行pyinstaller -F xx.pyw即可消除cmd窗口,如下图所示。
服务器租用托管,机房租用托管,主机租用托管,https://www.e1idc.com