pyqt设计
pyqt是python设计GUI的第三方包
作为一个小白,我觉得这篇博客贼好,我就是按照这个博客写的。
这个博客一共分5步,每一步都特别详细。
pyqt 打包exe时遇到的问题(我的python环境是anaconda3)
Python PyInstaller 打包报错:AttributeError: 'str' object has no attribute 'items'
1、 解决方案1
网上查询,可能是setuptools比较老: 更新一下 pip install --upgrade setuptools
按此方法,解决了我的问题,特记录。
2、 解决方案2
重新安装环境,不使用anaconda的环境
遇到问题2
PyQt5 Cannot read QLibraryInfo output: raised Expecting value: line 1 column 1 (char 0) when decoding
这个问题我猜测可能是版本不兼容问题, 问题可参考大神制作
具体就是找到
python3.5/dist-packages/PyInstaller/utils/hooks/qt.py line: 41#这里,然后修改如下
json_str = '{"isDebugBuild": false, "version": [5, 11, 2], "location": {"ArchDataPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "LibraryExecutablesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/libexec", "Qml2ImportsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/qml", "ExamplesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/examples", "DocumentationPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/doc", "PluginsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/plugins", "LibrariesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/lib", "ImportsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/imports", "HeadersPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/include", "TranslationsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/translations", "SettingsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "PrefixPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "DataPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt", "TestsPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/tests", "BinariesPath": "/usr/local/lib/python3.5/dist-packages/PyQt5/Qt/bin"}}'
注意:将/usr/local/lib
改为你自己的python路径