The individual uses a 64-bit computer to install 64-bit PYQT after the from Pyqt4.qtgui import * hint Importerror:dll load failed:%1 is not a valid Win32.
After unloading the 64-bit PYQT, the 32-bit PYQT is successfully installed. The Python2.7 is 32-bit and is not compatible with 64-bit PYQT.
The following is reproduced, reference http://blog.csdn.net/lainegates/article/details/8656102
QT is a C + + library, the library in Python must have interfaces, using Python to invoke C + + code, QT official selected sip this Python and Qt interface library.
On PYQT's official website, http://www.riverbankcomputing.co.uk/software/pyqt/download/
SIP download links can be found: http://www.riverbankcomputing.co.uk/software/sip/download
Install PYQT4 Now:
1. Install Python, I'm using Python-2.6.6.msi
2. Install SIP, I download to is sip-4.14.4.zip. I unpacked the SIP into the Python directory, C:\Python26\Lib\site-packages
3. Installation Pyqt4, because there are ready-made installation package, so very simple, in the official website download to the latest version of Pyqt4-4.10-gpl-py2.6-qt4.8.4-x32.exe, all the way next, installation completed.
The final test:
Python Shell Enter in:
Import SYS from Pyqt4.qtgui import * a = Qapplication (sys.argv) w = qwidget () w.resize (+) W.setwindowti Tle ("Hello, world!") W.show () Sys.exit (A.exec_ ())
Can run normally, say PYQT4 installation completes