Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 743
dealline Avatar asked Apr 17 '17 20:04

dealline


1 Answers

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.

like image 156
Galactic Ketchup Avatar answered Oct 16 '22 13:10

Galactic Ketchup