[PyQt] Using different versions of compiled PyQt under windows
rasky at develer.com
Tue Feb 24 19:31:05 GMT 2009
On Tue, 2009-02-24 at 15:53 -0200, Nahuel Defossé wrote:
> I'm trying to reduce the size of my pyqt4 app executable so I'd like to
> compile PyQt4 in different variations ( different modules compiled, for
> example, some apps don't need QtSql module, or at least, some drivers, in
> other cases QtSvg is not needed, some pieces of QtGui are not used on some
> apps). But I have no experience on having many versions of PyQt on windows.
> Is it possible? At least, I would have to fool PyInstaller about the acutal
> PyQt instalation.
If all you want is to select specific modules, you don't need to
recompile anything: just make sure that you use the correct import
statement in your code (that is: don't use "PyQt4.Qt", but use the
single modules like "PyQt4.QtSvg") and PyInstaller should simply do the
right thing. You can verify which one gets bundled by using
ArchiveViewer over your app (or switch to --onedir builds for
This doesn't bring it to the absolute minimum: the best solution is to
compile a solid version of PyQt (see configure.py --solid), which
generates a single _qt.pyd with all modules you need within. That cuts
down the executable size even more.
It's perfectly possible to have multiple version of PyQt on your system.
Just install them into different directories and use PYTHONPATH to pick
up the correct one.
More information about the PyQt