Skip to content Skip to sidebar Skip to footer

How To Exclude Unnecessary Qt *.so Files When Packaging An Application?

After the successful packaging of my PySide app using PyInstaller, I've found lots of different *.so files in a package folder. I was surprised seeing libraries I don't use in my p

Solution 1:

If you are sure that they are not necessary for your application you can exclude them with the Analysis in the spec file. You simply need to add them as shown here https://pythonhosted.org/PyInstaller/spec-files.html#spec-file-operation.

Here is what you could do:

a.binaries = a.binaries - TOC([
  ('libQt53DAnimation.so', None, None),
  ('libQt53DCore.so', None, None),
  ('libQt5Multimedia.so', None, None),
])

There is also an --exclude-module EXCLUDES for excluding modules but, not sure how relevant it is for your case.

Unfortunately, pyinstaller includes certain optional dependenices as Hartmut Goebel explains here

PyInstaller does it's best to include only the needed modules - that's what PyInstaller is about :-). But many packages have optional dependencies which for your program might not be necessary, but are for other programs. PyInstaller can't know this and if PyInstaller would remove to much, other programs might fail. Please use option --exclude for this.

Please keep in mind, that alone Python's feature "full unicode support" add a lot of codecs modules, which look unecessary but are required for Python to work properly.

Post a Comment for "How To Exclude Unnecessary Qt *.so Files When Packaging An Application?"