0

I know this question has been asked a lot, but I have a python project I'm working on that contains 150 kB of pure code. I use pyinstaller to package it, as I need a .exe file at the end.

But PyInstaller creates a 60 MB file, even with a trimmed down venv and single file enabled. I've heard of people trimming down files with numpy and pandas to <25 MB. However, I don't know if this is possible in my case as I use:

-tkinter
-numpy
-pandas
-scipy
-matplotlib

All of which are fairly large. Is there any hope to shrink this down?

d_v_t_
  • 56
  • 3
  • Are you developing inside a Python virtual environment? This will ensure that you only bundle the packages that you need. – wstk Feb 17 '20 at 10:41
  • Yes. By venv, I meant virtual environment. Sorry if that wasn't clear. – d_v_t_ Feb 18 '20 at 17:56
  • No sorry! That is perfectly reasonable to use venv, I just didnt notice. – wstk Feb 19 '20 at 08:24
  • You could try [UPX] (https://pyinstaller.readthedocs.io/en/stable/usage.html#using-upx), and see [this] (https://stackoverflow.com/questions/47730240/how-do-i-use-upx-with-pyinstaller) question. Also, depending on why you need the executable to be smaller - if you need to distribute it, you could use `--onedir` switch, and then zip the generated folder? – wstk Feb 19 '20 at 08:33

0 Answers0