Download the pyqt installation file for the Python version from the following link.
Http://www.riverbankcomputing.co.uk/static/Downloads/PyQt4
Here I selectPyQt-Py2.7-gpl-4.8.1-1.exe
1. Click Install. After installation, check whether the installation is complete. You can use from pyqt4.qtgui import * to test the installation.
If no error is reported, pyqt is successfully installed.
2. After the installation is complete, open the shell. Enter the following Python code
Import sys <br/> from pyqt4.qtgui import * <br/> A = qapplication (sys. argv) <br/> W = qwidget () <br/> W. resize (1, 320,240) <br/> W. setwindowtitle ("Hello, world! ") <Br/> W. Show () <br/> sys.exit(a.exe C _())
When running the above Code, you may report an error because the pyqt4 package is not within the scope of the system search, so the module cannot be imported.
Set
Print sys. Path
SYS. Path. append (r 'd:/python27/lib/Site-packages/pyqt4 ')
Print sys. Path
Added before import from pyqt4.qtgui *.
The code above will display a small window on the screen.
Now you have installed pyqt and completed the first simplest instance.