dealline
dealline

Reputation: 61

How to change the directory where cx_Freeze creates the "build" and "dist" folders?

python setup.py bdist_msi

How can change the directory where cx_Freeze creates the "build" and "dist" folders? When I run this command it creates them inside the python directory where I put the setup.py and myapp.py files, but I want to create them somewhere else.

Upvotes: 6

Views: 6145

Answers (1)

Galactic Ketchup
Galactic Ketchup

Reputation: 504

There's an option for that; when you execute your distutils setup script, e.g. python setup.py build, you can specify the directory as python setup.py build -b ..\somewhere\else\.

Alternatively, you can set it in the code in the option dict. e.g. change

options = {
    'includes': ['numpy.core._methods'],
    'excludes': ['tkinter']
}
setup(name="Application", options=options, executables=[Executable("run.py", base=None)]

in your setup script to

options = {
    'includes': ['numpy.core._methods'],
    'excludes': ['tkinter'],
    'build_exe': '..\\somewhere\\else\\'
}
setup(name="Application", options=options, executables=[Executable("run.py", base=None)]

Note that I've had some slightly different behavior with the two solutions; the first will put all of the files into a folder inside somewhere\else, whereas the second will simply put all of the files into somewhere\else.

Upvotes: 6

Related Questions