SIP must be installed before building and using PyQt4. You can get the latest release of the SIP source code from http://www.riverbankcomputing.com/software/sip/download.
The SIP documentation can be found at http://pyqt.sourceforge.net/Docs/sip4/.
You can get the latest release of the GPL version of the PyQt4 source code from http://www.riverbankcomputing.com/software/pyqt/download.
If you are using the commercial version of PyQt4 then you should use the download instructions which were sent to you when you made your purchase. You must also download your license file.
After unpacking the source package (either a .tar.gz or a .zip file depending on your platform) you should then check for any README files that relate to your platform.
If you are using the commercial version of PyQt4 then you must copy your license file to the sip directory.
You need to make sure your environment variables are set properly for your development environment.
In order to configure the build of PyQt4 you need to run either the configure-ng.py or the configure.py script.
configure.py is the original configuration script that uses the build system of SIP v4 (i.e. the sip.sipconfig module). It will be supported for the life of PyQt4.
configure-ng.py is the new configuration script that uses Qt’s qmake program to do all the heavy lifting. It has the following advantages:
Users are encouraged to switch to using configure-ng.py in order to ease the future transition to SIP v5 and/or PyQt5.
New in version 4.10.1.
The configure-ng.py script is used to configure PyQt4 as follows:
python configure-ng.py
This assumes that the Python interpreter is on your path. Something like the following may be appropriate on Windows:
c:\python33\python configure-ng.py
If you have multiple versions of Python installed then make sure you use the interpreter for which you wish to build PyQt4 for.
The full set of command line options is:
Any remaining command line arguments are expected to be in the form name=value or name+=value. Such arguments are added to any qmake .pro file created by configure-ng.py.
The configure.py script is used to configure PyQt4 as follows:
python configure.py
This assumes that the Python interpreter is on your path. Something like the following may be appropriate on Windows:
c:\python33\python configure.py
If you have multiple versions of Python installed then make sure you use the interpreter for which you wish to build PyQt4 for.
The full set of command line options is:
Note that this section only applies if you are using the configure.py script to configure PyQt4. The configure-ng.py script leaves it to Qt’s qmake program to handle the details. configure-ng.py does not support the creation of universal binaries.
Building applications for MacOS can be a complex process. Typically the following need to be taken into account:
If you are using a binary installer for Python and/or Qt then you also need to consider how they have been built regarding the above, and what bugs they have.
SIP’s and PyQt4’s configure.py scripts provide the necessary command line options to allow the correct configurations to be specified - the trick is to work out which options to use depending on the versions of Python and Qt you have installed.
SIP provides the following command line options to its configure.py script.
PyQt4 provides the --use-arch option that specifies which architecture certain PyQt4 tools (actually only pyuic4 at the moment) will use when running Python. For example, if your Qt installation is 32 bits, and your Python installation is 32 bits and 64 bits then you will need to specify --use-arch i386 to ensure that pyuic4 runs the 32 bit version of Python.
The next step is to build PyQt4 by running your platform’s make command. For example:
make
The final step is to install PyQt4 by running the following command:
make install
(Depending on your system you may require root or administrator privileges.)
This will install the various PyQt4 components.