Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PyQt4 cannot import QtGui but can import QtCore

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

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

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

but it seems I can import some packages(eg, QtCore) but not others (eg, QtGui)

although they are side by side in 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
like image 336
bahaelaila7 Avatar asked Mar 29 '13 18:03

bahaelaila7


2 Answers

Qt5Gui.dll depends on D3dCOMPILER_43.dll, which is part of DirectX. You can update your installation with the DirectX End-User Runtime Web Installer.

like image 138
Eryk Sun Avatar answered Dec 28 '22 07:12

Eryk Sun


If you don't like to install 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 in Linux for example (Debian based - should work similar on other distros):

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

In Windows you can extract cab-files for example with Winrar. Some windows versions included a command line utility for cab-files - I think it was called extract.

like image 27
TNT Avatar answered Dec 28 '22 07:12

TNT