10

I'm quite new to Mac OS X. when i tried to install PyQt on Mac Os X after installing python 3.1, Qt 4.6.2 and SIP 4.10.1 i encounter the following error when i execute $python3 configure.py command.

Determining the layout of your Qt installation...
This is the GPL version of PyQt 4.7 (licensed under the GNU General Public
License) for Python 3.1 on darwin.

Type '2' to view the GPL v2 license.
Type '3' to view the GPL v3 license.
Type 'yes' to accept the terms of the license.
Type 'no' to decline the terms of the license.

Do you accept the terms of the license? yes
Checking to see if the QtGui module should be built...
Checking to see if the QtHelp module should be built...
Checking to see if the QtMultimedia module should be built...
Checking to see if the QtNetwork module should be built...
Checking to see if the QtOpenGL module should be built...
Checking to see if the QtScript module should be built...
Checking to see if the QtScriptTools module should be built...
Checking to see if the QtSql module should be built...
Checking to see if the QtSvg module should be built...
Checking to see if the QtTest module should be built...
Checking to see if the QtWebKit module should be built...
Checking to see if the QtXml module should be built...
Checking to see if the QtXmlPatterns module should be built...
Checking to see if the phonon module should be built...
Checking to see if the QtAssistant module should be built...
Checking to see if the QtDesigner module should be built...
Qt v4.6.2 free edition is being used.
Qt is built as a framework.
SIP 4.10.1 is being used.
The Qt header files are in /usr/include.
The shared Qt libraries are in /Library/Frameworks.
The Qt binaries are in /Developer/Tools/Qt.
The Qt mkspecs directory is in /usr/local/Qt4.6.
These PyQt modules will be built: QtCore.
The PyQt Python package will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/site-packages.
PyQt is being built with generated docstrings.
PyQt is being built with 'protected' redefined as 'public'.
The Designer plugin will be installed in
/Developer/Applications/Qt/plugins/designer.
The PyQt .sip files will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/share/sip/PyQt4.
pyuic4, pyrcc4 and pylupdate4 will be installed in
/Library/Frameworks/Python.framework/Versions/3.1/bin.
Generating the C++ source for the QtCore module...
sip: Usage: sip [-h] [-V] [-a file] [-b file] [-c dir] [-d file] [-e] [-g] [-I dir] [-j #] [-k] [-m file] [-o] [-p module] [-r] [-s suffix] [-t tag] [-w] [-x feature] [-z file] [file]
Error: Unable to create the C++ code.

Anybody here installed PyQt on Mac OS X 10.6.2 successfully?

rae1
  • 6,066
  • 4
  • 27
  • 48
Jeba
  • 963
  • 4
  • 12
  • 25

6 Answers6

32

Try using brew:

brew install pyqt

It is more highly recommended than macports now.

th3morg
  • 4,321
  • 1
  • 32
  • 45
  • 3
    Warning! This works only if you are using the python from brew and not the one distributed with OS X. So if the first python in PATH is the OS X one, it will not work. – sorin Jul 12 '13 at 10:43
  • 1
    ... but you can add the path of PyQt to your `PYTHONPATH`. In fact, Homebrew will give you the path you will need to export, something along the lines of `export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH`. Put that in your `~/.bashrc` file and you should be good to go. – Stefan van den Akker Oct 20 '14 at 09:29
8

QT and PyQT also available to install on OSX using Homebrew

PhoebeB
  • 8,434
  • 8
  • 57
  • 76
  • I kept trying to install via pip and easy_install, but both those packages have problems installing. You just saved me from having to figure out Segmentation faults and dependencies – pocketfullofcheese Jan 12 '13 at 23:10
6

I had the same problem as you had. The solution is rather simple.

Because of a bug in configure.py of PyQt4, you are not supposed to have a space character in your PyQt4 source directory path. The error is due to a wrong syntax when configure.py invokes sip executable on an input path with spaces.

Kevin
  • 61
  • 1
  • 2
4

I had this problem, and indeed my PyQt source folder was in a directory which had a space character somewhere in the path.

I was able to make this work by moving the PyQt source folder to the root, and running python configure.py from there.

Mike Cavaliere
  • 670
  • 6
  • 10
1

You can also use PyQtX, which is a binary distribution of PyQt for OS X and also includes Qt libraries. You just need Python for it.

AbiusX
  • 2,379
  • 20
  • 26
  • 1
    This doesn't work with OS X 10.8, is complaining about not having Python 2.7 from the official distribution. That's ridiculous considering that the defacto python is the one that cames with the OS. – sorin Jul 12 '13 at 10:49
  • If you read the requirements before installation, it clearly states that you need to install Python from a Python.org distribution, and not the one that comes with Mac OS X. – AbiusX Sep 22 '13 at 17:56
  • 1
    This should be the correct answer, it is the easiest solution if you do not use a brew version of python. – Jim Feb 23 '14 at 23:17
0

Since you are using PyQt v4.7 you need to install Qt v4.7 too, go ahead and install Qt v4.7.1 first.

ismail
  • 46,010
  • 9
  • 86
  • 95