Can PyQt4 and Qt4/C++ co-exist peacefully on Windows?
Question: I had previously installed PyQt4 on my Windows XP machine and was successful
in getting everything to run. This evening, I downloaded the full Qt4 SDK
(open source version) and installed it as well. After adding the path to the
bin directory to my system environment path I was able to build a few small
programs I'd written in C++. Without changing my environment, I started up
python and tried to import PyQt4.QtCore and got an error that it couldn't load
the DLL. I removed from my environment path, the path to the Qt4 SDK bin
directory and was now able to run my python PyQt4 programs but I could no
longer build my C++ programs.

First off, I'm not sure why the presence of the C++ SDK should impact the
python version because they're in different directories. I assume the issue is
that, when python attempts to load the PyQt4 DLL, it thinks its using an
executable from the python path but, because the SDK path is first, that
(incompatible) version is what is actually invoked.

Is there a way that these two environments can leave peacefully with each
other such that I can build and run either type of program?


Answer: The issue, as you correctly suggest, tends to be that the versions of the
various DLLs (QtCore4.dll, QtGui4.dll etc) are different. I've tended to find
that the problem occurs for the one expecting a newer version (so if the Qt
SDK is installed second, but PyQt4 is in the path first, the Qt SDK would
complain), but it sounds like you've got a different problem.

There are two solutions that I've found to this:

  * Change your path for the different build/run environments (not very nice).

  * Make sure both PyQt4 and Qt/C++ are at the same Qt version so that either DLL will work (generally much easier).

Since I have started installing both PyQt4 and Qt/C++ on a computer when I
first start using it (and therefore they are at equivalent release versions),
I have rarely had any problems with them coexisting.

