Override default installation directory for Python bdist Windows Installer

Is it possible to specify a custom path for Python modules during installer creation (or during the actual installation)? As an example, suppose I have 5 modules for which I create an installer using:

c:\>python setup.py bdist 

Everything is correctly packaged, but when I install, they force me to install packages into the site. I need to specify the user directory of my (or the choice of the installer). At a minimum, I need to override the default value, so my custom path is displayed by default.

Is this possible using the built-in distribution?

+8
python distutils
source share
3 answers

You should write setup.cfg where you can specify the installation options (see python setup.py install --help output) and then run python setup.py bdist. When creating a binary distribution, python will perform a dull installation under the "build" subdirectory with these parameters and create an installer from this silent installation. For example, if you want to create a bdist that installs libraries in / some / lib / path and scripts in / some / bin / path, create the following setup.cfg:

 [install] prefix=/ install_lib=/some/lib/path install_scripts=/some/bin/path 

Then run python setup.py bdist

+10
source share

From running python setup.py --help install :

 Options for 'install' command: --prefix installation prefix --exec-prefix (Unix only) prefix for platform- specific files --home (Unix only) home directory to install under --user install in user site-package '/home/jterrace/.local/lib/python2.7/si te-packages' --install-base base installation directory (instead of --prefix or --home) --install-platbase base installation directory for platform-specific files (instead of -- exec-prefix or --home) --root install everything relative to this alternate root directory 
+1
source share

I believe that MaxSin's answer was somewhat correct. But to use his answer for the command: "python setup.py bdist_wininst" you would need to do this as follows:

 [bdist_wininst] prefix=/ install_lib=/some/lib/path install_scripts=/some/bin/path 

The syntax is here :

 [command] option=value ... 

edit:

This does not seem to work: (not sure about another possible solution.

+1
source share

All Articles