Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing PyQt

I'm trying to install PyQt on my mac so that I can install python ghost. I've already installed Qt, and SIP. I've downloaded PyQt, but when I run

python configure-ng.py    

I get the following error:

Error: Use the --qmake argument to explicitly specify a working Qt qmake.

Any ideas on what I should do?

like image 209
steeling Avatar asked Mar 27 '14 05:03

steeling


2 Answers

Since you are on a Mac, I would use Homebrew. This worked for me the other day, but took a long time to finish:

brew install pyqt
like image 135
Manuel Riel Avatar answered Oct 04 '22 19:10

Manuel Riel


Without command line using PyCharm IDE. Also I didn't need to install Qt.:

  • Download Python 3.6.1 (double click to install).
  • Download PyCharm IDE (double click to install).
    • Go to PyCharm>Preferences>Project Interpreter.
    • Point the project interpreter path to python.3.6.1
    • '+' button, search for pyqt5. Choose PyQt5 version 5.8.2 than click install package.

enter image description here

Automatically it is going to install PyQt 5.8.2 and SIP. After installed just, come back to Project Interpreter and make sure that SIP was installed too. If it is not installed: '+' button and install sip.

enter image description here

Try this code to see if it works for you too. :)

#!/usr/bin/env python3

from PyQt5.QtWidgets import QLabel, QVBoxLayout, QWidget
from PyQt5.QtCore import Qt


class Example(QWidget):

def __init__(self):
    super().__init__()
    self.initUI()

def initUI(self):
    self.setFixedSize(200, 100)
    self.setWindowTitle('Example')
    label = QLabel('Hello')
    layout = QVBoxLayout()
    layout.addWidget(label)
    layout.setAlignment(Qt.AlignCenter)
    self.setLayout(layout)


if __name__ == '__main__':

import sys
from PyQt5.QtWidgets import QApplication

app = QApplication(sys.argv)
ex = Example()
ex.show()
sys.exit(app.exec_())

enter image description here

like image 44
Jeremias Serafim Avatar answered Oct 04 '22 20:10

Jeremias Serafim