[PyQt] ImportError with v4.7 Windows Binary

"V. Armando Solé" sole at esrf.fr
Mon Jan 25 12:47:57 GMT 2010

Doug Bell wrote:
> FYI, I finaly found the problem.  There is a commercial program
> (CFDesign, from Blue Ridge Numerics) installed on this PC that uses Qt
> and has Qt DLLs in a directory that is included in the PATH.  If the
> CFDesign directory is renamed, then PyQt works again.
> I'm not sure what sequence Windows uses for finding DLLs on the PATH,
> but it evidently isn't in the order given in the environment variable.
If you want to know your actual path, just open a "Command prompt" and type:

echo %PATH%

nevertheless, windows is expected to look first into the program working 
directory for dlls.

Personally, under windows I open a command line prompt and I run a 
previously prepared bat file that sets my environment variables. That 
allows me to choose compiler, python version, etc, knowing what I'm doing.

For instance, for python 2.5 I use a bat file containing:

set PATH=C:\Python25;C:\Python25\Scripts;C:\Program 
rem "I am going to compile extensions with VS7"
call "C:\Program Files\Microsoft Platform SDK\setenv.cmd" /XP32 /RETAIL
call C:\environment\vcvars32.bat
set QMAKESPEC=win32-msvc2003
set QTDIR=C:\Qt\qt-win-opensource-src-4.5.3
set PATH=%QTDIR%\lib;%QTDIR%\bin;%PATH%;
set PATH=%PATH%;C:\Program Files\GnuWin32\bin;C:\Program Files\vim\vim64
set PATH=%PATH%;C:\Program Files\UnxUtils\usr\local\wbin

and for python 2.6:

set PATH=C:\Python26;C:\Python26\Scripts;C:\Program 
echo "Python 2.6 needs to compile extensions with VS9"
call "C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
set QMAKESPEC=win32-msvc2008
set QTDIR=C:\Qt\qt-win-opensource-src-4.5.2_py26_VS2008
set PATH=%QTDIR%\lib;%QTDIR%\bin;%PATH%;
set PATH=%PATH%;C:\Program Files\GnuWin32\bin;C:\Program Files\vim\vim64;

Two totally different environments coexisting at the price of having to 
start everything from the prompt.


More information about the PyQt mailing list