Pyinstaller:將.py文件打包爲.exe出現:AttributeError: module 'enum' has no attribute 'IntFlag'?

博主的環境如下:

Windows 10-10.0.17134-SP0

PyInstaller  3.3

PyQt  5.9.2

Python  3.6.3

使用PyQt寫了一個小程序,現在需要將其打包爲exe文件方便移植。使用pyinstall命令:

pyinstaller -F mainshishi.py

進行打包時出現:

 AttributeError: module 'enum' has no attribute 'IntFlag'

以及:

AttributeError: 'str' object has no attribute 'items' 

經查閱之後,發現是因爲電腦裏安裝了enum34這個包 ,這個包與python自帶的enum包衝突了,因此使用uninstall命令將其卸載即可!

完成卸載之後再用以上命令打包,發現打包成功:

且程序能夠正常運行:

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章