Skip to content
Advertisement

Reducing size of pyinstaller exe

I have a simple pandas pyinstaller exe which is over 40MB.

My exe example:

JavaScript

40MB+ for this seems a bit overkill.

How can I reduce this as much as possible?

One method:

JavaScript

This however is not practical considering how big the exclusion list would be.

How do I select a folder for pyinstaller to get modules from and exclude everything else so I may have a small application?

Spec file:

JavaScript

It’s also worth mentioning. By default, Pyinstaller does not detect pandas.

Add:

JavaScript

A possible solution when using multiple executables, could be to link each executable to a separate folder or executable with all imports.

Advertisement

Answer

try setting up your environment with a virtualenv, and install in there only the required libraries

some details on working with virtual env are here: https://virtualenv.pypa.io/en/stable/

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement