Question

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?

Was it helpful?

Solution

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

OTHER TIPS

configure-ng.py needs both qmake and sip to configure the build process.

The error message means that configure-ng.py could not locate the qmake executable. You need to specify its location, with something like this:

$ python configure-ng.py --qmake=/path/to/qmake

The location of qmake depends on 1) how you installed it and 2) the OS you are using.


For Mac OS, the less painful way (in my case) is to install sip and qmake using Homebrew

$ brew install sip

$ brew install qt

brew will install them in the directory: /usr/local/Cellar/

Then, run configure-ng.py with specifying both locations:

$ python configure-ng.py --qmake=/usr/local/Cellar/qt/VERSION/bin/qmake --sip=/usr/local/Cellar/sip/VERSION/bin/sip

If all good, continue PyQt installation:

$ make 

make takes a while (around 20 mins in my case).

And finally, install:

$ make install

make may needs admin permission $ sudo make

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top