Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python PyQt on macOS Sierra

Tags:

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.

like image 481
Bzzzt_90 Avatar asked Oct 02 '16 20:10

Bzzzt_90


People also ask

Does PyQt work on Mac?

Desktop applications made with PyQt are cross platform, they will work on Microsoft Windows, Apple Mac OS X and Linux computers (including Raspberry Pi).

Is Anaconda a PyQt?

Anaconda provides a user-friendly installation wizard that you can use to install PyQt on your system.


2 Answers

Make sure you have homebrew installed.

Use the following commands:

  1. brew tap cartr/qt4
  2. brew tap-pin cartr/qt4
  3. brew install qt
  4. brew install pyside
like image 68
Fardin Allahverdi Avatar answered Oct 19 '22 04:10

Fardin Allahverdi


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() 
like image 25
Kal Avatar answered Oct 19 '22 04:10

Kal