Exception: Cannot find PyQt5 plugin directories when using Pyinstaller despite PyQt5 not even being used

前端 未结 7 1081
谎友^
谎友^ 2020-12-14 08:59

A month ago I solved my applcation freezing issues for Python 2.7 as you can see here. I have since adapted my code to python 3.5 (using Anaconda) and it appears to be worki

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-14 09:38

    This still looks like an issue, which is why I'm resurrecting this old post in the event someone like me googles for a fix to the same issue.

    You don't need to uninstall or reinstall anything. I just installed latest version of Anaconda and pyinstaller and have come across the same error again.

    The problem is the ../Anaconda3\Lib\site-packages\PyInstaller\utils\hooks\qt.py file.

    The solution lies in the following link. https://github.com/pyinstaller/pyinstaller/issues/3938

                json_str = exec_statement("""
    
                # ... some code here ...
    
                else:
                    # QLibraryInfo isn't always valid until a QCoreApplication is
                    # instantiated.
                    app = QCoreApplication(sys.argv) # this is the part that's needed
    

    I hope the pyinstaller devs fix this at some stage.

提交回复
热议问题