pyuic5 - ModuleNotFoundError: No module named PyQt5.sip

后端 未结 5 1468
误落风尘
误落风尘 2021-02-15 15:25

I have just installed Anaconda 5.2 with Python 3.6 on my windows system. Also installed pyqt5 and pyqt5-tools via pip with administrator privilege. Now when I run pyuic5.exe for

相关标签:
5条回答
  • 2021-02-15 15:39

    As of June 2019, pyqt5-tools no longer exists. The solution I found was first installing pyqt5-sip and then install pyqt5

    $ pip install pyqt5-sip
    
    $ pip install pyqt5
    

    This seems to get rid of the following error: ModuleNotFoundError: No module named 'PyQt5.sip'

    0 讨论(0)
  • 2021-02-15 15:40

    I am also a MAC user, but found adding the code below fixed my problem with "no module named sip":

    from PyQt5.QtCore import QCoreApplication

    0 讨论(0)
  • 2021-02-15 15:49

    None of the answers above worked for PyQt5 5.13.0 on conda's python 3.6.

    With pyqt5 and pyqt5-sip installed just go into python's site-packages and copy sip.so from the PyQt5_sip package to PyQt5 folder (or make a symlink) where the rest of Qt's so modules are.

    Seems like a poor decision to pull sip out into a separate package.

    0 讨论(0)
  • 2021-02-15 15:52

    I am a Mac user and I had faced a similar issue. However, I understand for window users, what you are looking for is pyuic5.bat and not pyuic5.sip It seems you'll simply have to provide the full path of the pyuic file(for me, it was under a hidden folder usr in the home directory: /usr/local/Cellar/pyqt/5.10.1_1/bin/pyuic5) and do make sure on your terminal(for you, cmd) you have the directory changed to where the *.ui file lies which you wish to convert to a *.py file.

    So for instance, if you have a Qt designer file saved by the name untitled.ui on your desktop, put in the following command in your terminal:

    Amars-MacBook-Pro:Desktop amaradak$ /usr/local/Cellar/pyqt/5.10.1_1/bin/pyuic5 -x untitled.ui -o untitled.py
    

    Hope this helps... Cheers

    0 讨论(0)
  • 2021-02-15 15:54

    According to Agile_Eagle's suggestion from the comments I just uninstalled pyqt5 and pyqt5-tools packages and the reinstalled them. Problem solved!

    PS.: If you still got problems with PyQt, try uninstalling all of the PyQt related libraries:

    pip uninstall PyQt5
    pip uninstall PyQt5-sip
    pip uninstall PyQtWebEngine
    

    Then install them again, this will fix:

    ModuleNotFoundError: No module named 'PyQt5.sip'
    ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'
    

    PPS.:If you got problems uninstalling the libraries, go to your Python folder, like C:\Users\<USERNAME>\AppData\Local\Programs\Python\Python<PYTHON-VERSION>\Lib\site-packages and manually delete the PyQt folders, then uninstall everything and install again (Make sure you have the latest Python version and upgraded your pip too)

    0 讨论(0)
提交回复
热议问题