Install python pyqt4 on macOS 10.12 Sierra?

Anaconda python (https://www.continuum.io/) provides binaries for a wide variety of packages including pyqt and all required support libraries. Similar to virtualenv, conda allows separate environments to be created with different versions of the packages; in your case, various versions of qt 4 and qt 5.

Download the 20MB bash installer for Python 2.7 http://conda.pydata.org/miniconda.html

install with bash Miniconda2-latest-MacOSX-x86_64.sh

The following packages are required for electrum:

conda create -n electrum python=2.7 pyqt=4.11.4 dnspython ecdsa pbkdf2 protobuf requests six
source activate electrum

Additional dependencies not available in anaconda can be installed via pip:

pip install dnspython jsonrpclib qrcode slowaes

You can then install electrum as usual:

git clone https://github.com/spesmilo/electrum.git
cd electrum
pyrcc4 icons.qrc -o gui/qt/icons_rc.py
python setup.py install

The resulting command will be in the bin directory of the electrum environment. This can be symlinked into ~/bin as follows:

ln -s ~/anaconda/envs/electrum/bin/electrum ~/bin

You can now run electrum from the terminal even when the anaconda environment is not loaded.

electrum