How to set up PyQt4 for python 3.2 in Ubuntu 11.04 and 11.10
Edit: This guide is now fairly out of date, I strongly recommend people move to Ubuntu 12.04 LTS where pyqt4 and qt4 designer are already packaged, no compiling required!
Hopefully this will give it a bit more coverage on the interwebs:
1) Before compiling any software ensure build-essential is installed
sudo apt-get install build-essential
(11.10 users go to step 3)
2) Open the synaptic package manager and install python 3.2
3) Next open a terminal emulator and type:
sudo apt-get install libqt4-dev
4) Download the program SIP from:
http://www.riverbankcomputing.com/software/sip/download
5) extract the folder using tar -xzf sip-X.XX.X.tar.gz, cd into folder.
6) in terminal emultator, type:
python3.2 configure.py
make
sudo make install
SIP should now be installed.
If you receive the error:
siplib.c:20:20: fatal error: Python.h: No such file or directory compilation terminated. make[1]: *** [siplib.o] Error 1
You will need to install python3.2-dev (sudo apt-get install python3.2-dev) and repeat the above.
7) install pyqt4 with the command:
sudo apt-get install python-qt4 qt4-dev-tools python-qt4-dev pyqt4-dev-tools
You can then try step 8.
If that didn’t work for you, download pyqt4 from: http://www.riverbankcomputing.co.uk/software/pyqt/download
Untar and install pyqt4 the same way you installed SIP.
1) in terminal extract the folder using tar -xzf PyQt-x11-gpl-X.X.X.tar.gz and then cd into the folder.
2) in terminal emultator, type:
python3.2 configure.py
make
sudo make install
8) You should then be able to type in terminal (case sensitive):
python3.2
>>import sys
>>from PyQt4 import QtGui
If this works without error PyQt4 is installed and works with Python 3.2! Hurrah!
Source: Neurobot (http://ubuntuforums.org/showpost.php?p=10914908)