-
Notifications
You must be signed in to change notification settings - Fork 78
Compiling PyQt5 on Ubuntu 12.04
mottosso edited this page Jan 1, 2015
·
21 revisions
This guide provides basic instructions on getting PyQt5 compiled on Ubuntu 12.04 x64 for Python 2.7
To complete this compilation, you'll need to three things.
- Download and install
Qt 5.3.1
- Download and unpack
sip-4.16.5
- Download and unpack
PyQt 5.3.2
5.4 was recently released, and it's quite likely that the process is identical to compiling 5.3.1, but I have yet to give it a try.
- Install Qt
# First turn the newly downloaded file into an executable
$ chomd +x qt-opensource-linux-x64-5.3.1.run
$ ./qt-opensource-linux-x64-5.3.1.run
- Install Dependencies
# Install C++ compiler for Make
$ sudo apt-get install build-essential
# Install Python source
$ sudo apt-get install python-dev
# Install PyQt-specific libraries for Ubuntu
$ sudo apt-add-repository ppa:ubuntu-sdk-team/ppa
$ sudo apt-get update
$ sudo apt-get install qtdeclarative5-dev
- Compile SIP
$ cd sip-4.16.5
$ python configure.py
$ make
$ sudo make install
- Compile PyQt
# --qmake: Tell compiler about location of Qt binaries
# --sip-incdir: Tell compiler about location of SIP
$ cd ../PyQt-gpl-5.3.2
$ python configure.py --qmake ~/Qt/5.3/gcc_64/bin/qmake --sip-incdir ../sip-4.16.5/siplib
$ make
$ sudo make install
PyQt should now be accessible from the version of Python you first ran configure.py with.
>>> import sys
>>> from PyQt5 import QtWidgets
>>> app = QtWidgets.QApplication(sys.argv)
>>> button = QtWidgets.QPushButton("Hello, World!")
>>> button.show()
If this produces a new window with a single button in it, you're good to go!
Welcome to the wiki for PyQt5 using Python 2.7. For Python 3.4, head here
Table of contents
Developer Resources
Compilation Instructions