Install old version PyQt4 on a mac by compiling the source

Felix Voigt info at felibunda.eu
Wed Jul 7 22:20:26 BST 2021


On my MacBookPro with Mojave (macOS 10.14.6) I would like to run python2.7 with the pyqt 4 or 5 module. The reason is that I have an old python program which is written for this constellation. I installed python2.7.18 via pyenv2.0.2 and want to compile pyqt4 or pyqt5 for this python version. 

First I compiled and installed sip, which worked without problems (download from https://riverbankcomputing.com/software/sip/download):
cd ~/documents/tmp/sip-4.19.25
~/.pyenv/versions/2.7.18/bin/python2.7 configure.py
make
make install

Then I wanted to compile pyqt4 in a similar way (download from https://riverbankcomputing.com/software/pyqt/download):
cd ~/documents/tmp/PyQt4_gpl_mac-4.12.3
~/.pyenv/versions/2.7.18/bin/python2.7 configure.py
This gave me an error: /usr/local/bin/qmake failed to create a makefile.

I extended the command in several steps to:
~/.pyenv/versions/2.7.18/bin/python2.7 configure.py --qmake /usr/local/Cellar/qt at 4/4.8.7_6/bin/qmake --sip=/Users/felixvoigt/.pyenv/versions/2.7.18/bin/sip --verbose
This gave me yet another error output:
In file included from qtdirs.cpp:1:
In file included from /usr/local/Cellar/qt/6.1.1/lib/QtCore.framework/Versions/A/Headers/QCoreApplication:1:
In file included from /usr/local/Cellar/qt/6.1.1/lib/QtCore.framework/Versions/A/Headers/qcoreapplication.h:43:
/usr/local/include/QtCore/qglobal.h:45:12: fatal error: 'type_traits' file not found
#  include <type_traits>

I removed qt (version 6.1.1) which was installed via homebrew, because I thought this might be the reason for the error. (qt4 and qt5 are still installed.) With the same command as above, this led to the new error:
qtdirs.cpp:1:10: fatal error: 'QCoreApplication' file not found
#include <QCoreApplication>

Does somebody have a hint for me?

Regards
feli_x




More information about the PyQt mailing list