ImportError: No module named PytQt5

后端 未结 5 706
礼貌的吻别
礼貌的吻别 2020-12-14 01:02

following are my python, qt and sip versions

root@thura:~# python -V
Python 2.7.3
root@thura:~# qmake --version
QMake version 3.0
Using Qt version 5.0.2 in /         


        
相关标签:
5条回答
  • 2020-12-14 01:29

    pip install pyqt5 for python3 for ubuntu

    0 讨论(0)
  • 2020-12-14 01:42

    This probably means that python doesn't know where PyQt5 is located. To check, go into the interactive terminal and type:

    import sys
    print sys.path
    

    What you probably need to do is add the directory that contains the PyQt5 module to your PYTHONPATH environment variable. If you use bash, here's how:

    Type the following into your shell, and add it to the end of the file ~/.bashrc

    export PYTHONPATH=/path/to/PyQt5/directory:$PYTHONPATH
    

    where /path/to/PyQt5/directory is the path to the folder where the PyQt5 library is located.

    0 讨论(0)
  • 2020-12-14 01:43

    this can be solved under MacOS X by installing pyqt with brew

    brew install pyqt
    
    0 讨论(0)
  • 2020-12-14 01:50

    After getting the help from @Blender, @ekhumoro and @Dan, I understand the Linux and Python more than before. Thank you. I got the an idea by @ekhumoro, it is I didn't install PyQt5 correctly. So I delete PyQt5 folder and download again. And redo everything from very start.

    After redoing, I got the error as my last update at my question. So, when I search at stack, I got the following solution from here

    sudo ln -s /usr/include/python2.7 /usr/local/include/python2.7
    

    And then, I did "sudo make" and "sudo make install" step by step. After "sudo make install", I got the following error. But I ignored it and I created a simple design with qt designer. And I converted it into python file by pyuic5. Everything are going well.

    install -m 755 -p /home/thura/PyQt/pyuic5 /usr/bin/
    strip /usr/bin/pyuic5
    strip:/usr/bin/pyuic5: File format not recognized
    make: [install_pyuic5] Error 1 (ignored)
    
    0 讨论(0)
  • 2020-12-14 01:51

    If you are on ubuntu, just install pyqt5 with apt-get command:

        sudo apt-get install python3-pyqt5   # for python3
    

    or

        sudo apt-get install python-pyqt5    # for python2
    

    However, on Ubuntu 14.04 the python-pyqt5 package is left out [source] and need to be installed manually [source]

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