故障形式
File "C:\Users\UserX\AppData\Roaming\Python\Python310\site-packages\PyInstaller\utils\hooks\qt.py", line 730, in get_qt_qml_files
qmldir = qt_library_info.location['Qml2ImportsPath']
KeyError: 'Qml2ImportsPath'
解决方法是:
Possible solution
Use ‘QmlImportsPath’ instead of ‘Qml2ImportsPath’ on line 730.
A change of this line allows the program to finish successfully on my setup.
For the implementation of this fix you may need to consider backwards compatibility for older PySide/PyQt versions…
就是把qt.py文件中标记的地方代码更换
GitHub也有类似的解决办法
https://github.com/pyinstaller/pyinstaller/issues/7164