Search code examples
pythondistutilscx-freeze

How do I specify the default install path of an msi in cx_freeze and distutils?


I am trying to create an installer from a Python application we coded. I wrote a simple setup.py file and it generates a .msi file no problem, but I can't figure out the way to specify the default install path. We don't want it to install to the default "C:\Program Files" directory. Help?


Solution

  • Distutils is rather limited in functionality when it comes to creating installers. I would suggest you use NSIS instead. Its quite simple and lets you customise a lot more than distutils.

    The other way would be to manually add --initial-target-dir to the argument list in setup.py (before calling the setup function):

    if 'bdist_msi' in sys.argv:
        sys.argv += ['--initial-target-dir', 'c:\default\path']