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

python setup.py bdist_msi

How do I 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.

+3


source to share


1 answer


There is an option; when you do a distutils script setup eg. python setup.py build

, you can specify the directory as python setup.py build -b ..\somewhere\else\

.

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

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

      



in script settings before

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 had somewhat different behavior with these two solutions; the first will put all files in a folder inside somewhere\else

, whereas the second will just put all files in somewhere\else

.

+2


source







All Articles