PyQt4 cannot import QtGui, but can import QtCore

I installed python3.3 x86 (official python.org installer) in this 32-bit window 7

then installed PyQt4-4.10 for python3.3 windows x86 from here PyQt4-4.10-gpl-Py3.3-Qt5.0.1-x32-2.exe , the official installer too, the full installation of PyQt4 (including Qt Runtime)

I double checked that both python and PyQt4 are on $ PATH

but it seems that I can import some packages (e.g. QtCore), but not others (e.g. QtGui)

although they are side by side on the same path

>>> from PyQt4 import QtCore >>> QtCore.__file__ 'C:\\Python33\\lib\\site-packages\\PyQt4\\QtCore.pyd' >>> from PyQt4 import QtGui Traceback (most recent call last): File "<pyshell#2>", line 1, in <module> from PyQt4 import QtGui ImportError: DLL load failed: The specified module could not be found. >>> import os >>> os.path.exists('C:\\Python33\\lib\\site-packages\\PyQt4\\QtGui.pyd') True >>> from PyQt4 import Qt >>> from PyQt4 import QtXml >>> from PyQt4 import QtNetwork >>> from PyQt4 import QtDesigner Traceback (most recent call last): File "<pyshell#8>", line 1, in <module> from PyQt4 import QtDesigner ImportError: DLL load failed: The specified module could not be found. >>> os.path.exists('C:\\Python33\\lib\\site-packages\\PyQt4\\QtDesigner.pyd') True 
+6
source share
2 answers

Qt5Gui.dll depends on D3dCOMPILER_43.dll, which is part of DirectX. You can upgrade your installation using the DirectX end-user web installer .

+6
source

If you do not like installing the whole DirectX, you can do the following:

First download the Directx redistributable: http://www.microsoft.com/en-us/download/details.aspx?id=8109 (this is a kind of self-extracting MS-Cabinet file)

Then on Linux, for example (based on Debian - should work similarly on other distributions):

 sudo apt-get install cabextract mkdir cabs cabextract -d cabs -F JUN2010\* directx_Jun2010_redist.exe cd cabs mkdir x64 cabextract -d x64 -F \*.dll *_x64.cab 

On Windows, you can extract cab files, for example, using Winrar. Some versions of Windows included a command-line utility for cab files - I think it was called extract .

+1
source

All Articles