The following all worked when I installed PyQt4:
1
2
3
brew update
brew install pyqt
brew test pyqt
Line 3 is a test that shows a small Qt GUI (this worked). However, I could not import the module:
python
>>> import PyQt4
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
No module named PyQt4
I think it was because I have multiple versions of Python on this old system. Python was probably installed with MacPorts (or something) and also brew. Running the following fixed the problem:
brew link python
this will ensure that
which python
points to the brew Python which is the Python being used to run
brew test pyqt
which we know works.