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.
Desktop applications made with PyQt are cross platform, they will work on Microsoft Windows, Apple Mac OS X and Linux computers (including Raspberry Pi).
Anaconda provides a user-friendly installation wizard that you can use to install PyQt on your system.
Make sure you have homebrew installed.
Use the following commands:
brew tap cartr/qt4
brew tap-pin cartr/qt4
brew install qt
brew install pyside
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()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With