I need to port some code that's Python2+PyQt4 to Python3+PyQt5.
I started installing pip3
sudo apt-get install python3-pip
Works great. Tried
sudo pip3 install PyQt5 Downloading/unpacking PyQt5 Could not find any downloads that satisfy the requirement PyQt5 Cleaning up... No distributions at all found for PyQt5
Online I find the following steps:
http://pyqt.sourceforge.net/Docs/PyQt5/installation.html
But they are too many. What's the easiest way to Install PyQt5 along with Python3 in Ubuntu 14.04 ?
Install PyQt5 via apt In Ubuntu you can install either from the command line or via "Software Center". The package you are looking for is named python3-pyqt5 . After install is finished, you should be able to run python (or python3 ) and import PyQt5 without errors.
PyQt5 wheels are specific to a particular version of Python. Only Python v3. 5 and later is supported. Wheels are provide for 32- and 64-bit Windows, 64-bit OS X and 64-bit Linux.
First use the installer from the qt-project website, from qt to install PyQt. Next you want to install a Python version 3.3 or newer. Check the box to add all of the PyQt5 extras. It's not necessary to compile everything from source, you can install all the required packages with the installer.
PyQt5 is a comprehensive set of Python bindings for Qt v5. It is implemented as more than 35 extension modules and enables Python to be used as an alternative application development language to C++ on all supported platforms including iOS and Android.
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
pip3 install --user pyqt5 sudo apt-get install python3-pyqt5 sudo apt-get install pyqt5-dev-tools sudo apt-get install qttools5-dev-tools
$ 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
Create uic.py file.
#!/usr/bin/python3 import subprocess import sys child = 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] Name=Qt5 Designer Icon=designer Exec=/usr/lib/x86_64-linux-gnu/qt5/bin/designer Type=Application Categories=Application Terminal=false StartupNotify=true Actions=NewWindow Name[en_US]=Qt5 Designer [Desktop Action NewWindow] Name=Open a New Window Exec=/usr/lib/x86_64-linux-gnu/qt5/bin/designer
save in ~/.local/share/application with .desktop extension
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With