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

前端 未结 7 1066
谎友^
谎友^ 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.

    0 讨论(0)
  • 2020-12-14 09:39

    Uninstall Anaconda and everything works... I conclude that you simply cannot have Anaconda installed and use the standard Python 3.5 compiler at the same time if you're using Pyinstaller. Maybe this is related.

    This is not the first time that uninstalling Anaconda appears to solve my issues... If I should report this issue somewhere please comment below. I don't know where.

    0 讨论(0)
  • 2020-12-14 09:40

    [specifically for an anacodna installation] I had the same problem, but it got fixed when I updated anaconda. From the Anaconda prompt: conda update anaconda. This updates several packages including pyqt

    0 讨论(0)
  • 2020-12-14 09:51

    I managed to fix the same problem I encountered (conda 4.5.4, pyinstaller 3.4) without uninstalling conda:

    pip install PyQt5
    

    conda already installed PyQt when I used conda install jupyter seaborn. Interestingly, using conda install PyQt5 does not fix my problem. I don't know why. In any case I hope this may help someone out there.

    0 讨论(0)
  • 2020-12-14 09:51

    I think there is an issue with the current version of pyinstaller. I uninstalled the default version.

    pip uninstall pyinstaller

    and installed the latest trial version

    pip install https://github.com/pyinstaller/pyinstaller/archive/develop.zip

    and then it worked for me.

    More information here: https://github.com/pyinstaller/pyinstaller/issues/3938

    0 讨论(0)
  • 2020-12-14 09:51

    What worked for me (whicle trying to convert to .exe a script named main.py ) is a variation of kierabeth. More specifically the following:

    1. first create a spec file and exclude the PyQt5 module

      pyi-makespec --onefile main.py --exclude-module PyQt5
      
    2. then build the spec file

      pyinstaller main.spec
      
    0 讨论(0)
提交回复
热议问题