How can I get to work PyQt 4 or 5 on a Mac with OS X Sierra? It seems that I have to wait for a new version of PyQt but I am not sure if that is actually true.
Considering PyQt4 is no longer actively supported by its creators, I'd recommend using PyQt5 (plus I found it much easier to get working). Once you've installed pip3
(you can use easy_install
) run the following commands in your terminal:
1) pip3 install sip
2) pip3 install PyQt5
You can then run the following sample app to see if everything is working:
import sys
from PyQt5 import QtWidgets
def main():
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
button = QtWidgets.QPushButton("Hello, PyQt!")
window.setCentralWidget(button)
window.show()
app.exec_()
if __name__ == '__main__':
main()