This is a static archive of the Python wiki, which was retired in February 2026 due to lack of usage and the resources necessary to serve it — predominately to bots, crawlers, and LLM companies.
Pages are preserved as they were at the time of archival. For current information, please visit python.org.
If a change to this archive is absolutely needed, requests can be made via the infrastructure@python.org mailing list.

How to distribute only the qt4 dlls and pyqt libraries that your application really needs

If you want to finetune the size of a PyQt application, the best way is to recompile Qt/PyQt to use a consolidated module. Basically:

  1. Compile Qt statically (configure --static). It will build static libraries (.lib) instead of dlls.

  2. Compile PyQt with --consolidate (but *without* --static, since you still want a dynamic .pyd module). Add --enable for the modules you need and --plugin for the plugins you need. This will give you a big _qt.pyd with everything inside (no external dependencies), plus small Qt*.pyd wrappers to make your existing code work. You will save space twice because:

    • it will just include the parts you need
    • it will compress *tons* better (because there are no relocations symbols, more stuff is inlined, etc.).
  3. Give that to PyInstaller trunk with latest UPX (with LZMA support) and its's done.

Then, you might want to see the output of ArchiveViewer.py run over the final executable, so that you will see the list of all modules that have been brought in. If there's something that PyInstaller thought you might need but you actually don't use, you can hand-edit the excludes=[] list in the .spec file to avoid bringing them in.


2026-02-14 16:12