0

I'm using:
Windows 10
Python 3.8.1
tkinter 8.6.3
cx_freeze 6.1

I am using cx_freeze with a setup.py file to compile my python script (Note: I also got PyInstaller to work - it has the same problem). It creates an exe that runs. Unfortunately, it also creates a "lib" directory that's over 26 MB (18 MB for PyInstaller) and is mostly unnecessary.

Examples:
libcrypto-1_1.dll (not using crypto, this takes up 2.2 MB)
unicodedata.pyd (not using unicode, this takes up 1 MB)
libssl-1_1.dll (not using ssl, this takes up >500 KB)

There is also a tkinter folder created with > 6 MB of files.
In that, there are the following subfolders:
tcl\encoding (~1.3 M) and has all kind of encoding I'm not using
tcl\msgs (~100K) with a bunch of useless msg files in different languages in it
tcl\tzdata (~1.3M) with time zone data I don't need
tk\demos (~720K) with demos I don't need tk\images (~100K) with images I don't need tk\msgs (~100K) with more msg files I don't need tk\ttk (~120K) with themes I'm not using

...and a whole bunch of other files I suspect I don't need. This is a small script with a very small target audience (me and a handful of other users, portability is not required here). I have found and deleted useless files. I discover not needing them, by deleting them and seeing if my .exe file crashes or runs. Every time I update my program and recompile, it's regenerating the files. I'm keeping a list but I'm tired of checking what's changed, then finding and deleting the unnecessary files every time. How can I prevent these all from being created when I compile?

Community
  • 1
  • 1
Trashman
  • 1,424
  • 18
  • 27
  • 2
    "mostly unnecessary"? That sounds impossible — it either is or isn't. – martineau Feb 04 '20 at 19:38
  • There are a large number of files in the lib folder. Some of them are necessary. Most of them are not. Hence, "mostly unnecessary". – Trashman Feb 04 '20 at 19:43
  • This other question might be useful: https://stackoverflow.com/q/27281317/11301900 – AMC Feb 04 '20 at 19:48
  • Yes, it was a little useful. Unfortunately, pip freeze doesn't seem to list everything, and definitely doesn't list the parts of tkinter when you need some of tkinter but not everything included with it. Another link I found useful (but doesn't completely answer my question): https://stackoverflow.com/questions/3900375/understanding-what-files-in-the-tcl-are-required-for-distributing-frozen-python – Trashman Feb 04 '20 at 19:52

0 Answers0