No module named 'PyQt5.sip'

使用pyinstaller打包python文件为windows可执行程序可能遇到的问题

pyinstaller yourprogram.py打包的程序双击打开一闪而过,提示上面标题的错误

把pycom.py换成你的主程序文件名,下同
解决方法:
pyinstaller --hidden-import PyQt5.sip pycom.py

如果你想把可执行程序打包成一个文件,命令为:
pyinstaller -F --hidden-import PyQt5.sip pycom.py

如果你想加入自己的logo,命令为:
pyinstaller -F --hidden-import PyQt5.sip -i logo.ico pycom.py

如果你想双击打开程序不出现dos窗口,打包命令为:
pyinstaller -F --hidden-import PyQt5.sip -i logo.ico pycom.py --noconsole


猜你喜欢

转载自www.cnblogs.com/kunx/p/10094029.html