How to install PyQt5 in Python 3 (Ubuntu 14.04) How to install PyQt5 in Python 3 (Ubuntu 14.04) python-3.x python-3.x

How to install PyQt5 in Python 3 (Ubuntu 14.04)


Why not simply install it via apt-get?

sudo apt-get install python3-pyqt5

Otherwise you'd have to compile PyQt (and potentially Qt) by hand, which is cumbersome.


Well I documented the steps for Installing pyqt5 with qt designer and code generation here: https://gist.github.com/ujjwal96/1dcd57542bdaf3c9d1b0dd526ccd44ff

Installation

pip3 install --user pyqt5  sudo apt-get install python3-pyqt5  sudo apt-get install pyqt5-dev-toolssudo apt-get install qttools5-dev-tools

Configuring to run from terminal

$ qtchooser -run-tool=designer -qt=5

OR

Write the following in /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf

/usr/lib/x86_64-linux-gnu/qt5/bin/usr/lib/x86_64-linux-gnu

Code Generation

Create uic.py file.

#!/usr/bin/python3import subprocessimport syschild = subprocess.Popen(['pyuic5' ,'-x',sys.argv[1]],stdout=subprocess.PIPE)print(str(child.communicate()[0],encoding='utf-8'))

$ chmod +x uic.py

Create a symlink:

$ sudo ln uic.py "/usr/lib/x86_64-linux-gnu/qt5/bin/uic"

Desktop Entry

[Desktop Entry]Name=Qt5 DesignerIcon=designerExec=/usr/lib/x86_64-linux-gnu/qt5/bin/designerType=ApplicationCategories=ApplicationTerminal=falseStartupNotify=trueActions=NewWindowName[en_US]=Qt5 Designer[Desktop Action NewWindow]Name=Open a New WindowExec=/usr/lib/x86_64-linux-gnu/qt5/bin/designer

save in ~/.local/share/application with .desktop extension


  • sudo apt-get install python3-pip
  • sudo pip3 install PyQt5