Installation of PyQt on Linux (Ubuntu)

Rob Oakes | May 12, 2009 1:52 pm

In comparison to Windows and Mac OS X, installing PyQt on Linux is trivially easily.  It is likely that all of the software necessary for Python development is likely available in your favorite distribution repository.  If you are using the most recent version of Ubuntu 9.04 (and who isn’t), then, all you need to do is open up your terminal and type:

sudo apt-get install python-qt4 qt4-dev-tools python-qt4-dev build-essential pyqt4-dev-tools

The package manager (apt-get) will take care of downloading and installing any dependencies.  Once the installation routine finishes, you will have a fully working installation of Qt 4.5 and PyQt 4.5 without any compilation, configuration, or other miscellaneous headaches.  The qt4-dev-tools, pyqt4-dev-tools and python-qt4-dev packages install important tools used for creating user-interfaces.  The build-essential package installs the GNU compilers and autoconf tool chain.  If you will only be running PyQt programs, these additional packages are unnecessary.

Similar Posts:

3 Responses to “Installation of PyQt on Linux (Ubuntu)”

Khedron wrote a comment on June 17, 2009

Hmm, that’s funny.

$ cat /etc/issue
Ubuntu 9.04 \n \l

$ aptitude show python-qt4 | grep Version
Version: 4.4.4-2ubuntu6
$

Not PyQt 4.5. I was rather hoping for an easy way to get PyQt 4.5 on my Ubuntu, as it has a rather nice new signal API, but it seems I might have to manually install it.

Rob Oakes wrote a comment on June 21, 2009

@ Khedron. While the version of python-qt4 is only 4.4.4, the underlying Qt version is 4.5.1 (or at least it is on the computer I’m running). Thus, the only package that would need to be uninstalled and manually compiled is python-qt. This is a great deal less onerous than having to manually compile and the various components on either Mac OS X or Windows.

Rob Oakes wrote a comment on August 12, 2009

If you are installing Time Drive, you will also need to add the pyqt4-dev-tools package:

sudo apt-get install pyqt4-dev-tools

The instructions above have been updated to reflect this.