在使用pyinstaller打包py文件生成可执行文件exe出现闪退问题,解决方法:

在需要打包的py文件中的主函数最后一行添加如下代码:

python2: raw_input('please input any key to exit')
python3: input('please input any key to exit')

然后重新打包,生成exe文件