Search code examples
pythoncx-freezepython-3.6

How to put the .pyd and subfolders of a cx_Freeze executable in a single folder separately from the executable


I have an executable built with cx_Freeze that I want to distribute. The executable file works, but it's buried in the build folder among tons of other subfolders and .pyd and .dll files, and I'd like to clean it up, ideally having only the executable and another folder in which all necessary files are located.

I'm using cx_Freeze because as far as I know other freezers don't work with 3.6 yet, which is a requirement.

I came across this question that details the same problem. An answer from it says that there wasn't a way to do it with the released version at the time, but would be available with 5.x, which is already out. I haven't been able to identify this from the changelogs.


Solution

  • I have managed to solve the issue.

    The feature was planned for version 5.x, but due to internal changes, didn't make it.

    It is present in as-of-now unreleased versions, though. I solved it by downloading the source for cx_Freeze from its repository and following instructions to compile and install it. Now there's just 3 DLLs in the executable's folder and the rest of the files are in a single lib folder, much cleaner.