Original Translation
91
Alternate installation: Unix (the prefix scheme)
92
The "prefix scheme" is useful when you wish to use one Python installation to perform the build/install (i.e., to run the setup script), but install modules into the third-party module directory of a different Python installation (or something that looks like a different Python installation). If this sounds a trifle unusual, it is---that's why the "home scheme" comes first. However, there are at least two known cases where the prefix scheme will be useful.
93
First, consider that many Linux distributions put Python in :file:`/usr`, rather than the more traditional :file:`/usr/local`. This is entirely appropriate, since in those cases Python is part of "the system" rather than a local add-on. However, if you are installing Python modules from source, you probably want them to go in :file:`/usr/local/lib/python2.{X}` rather than :file:`/usr/lib/python2.{X}`. This can be done with ::
94
/usr/bin/python setup.py install --prefix=/usr/local
95
Another possibility is a network filesystem where the name used to write to a remote directory is different from the name used to read it: for example, the Python interpreter accessed as :file:`/usr/local/bin/python` might search for modules in :file:`/usr/local/lib/python2.{X}`, but those modules would have to be installed to, say, :file:`/mnt/{@server}/export/lib/python2.{X}`. This could be done with ::
96
/usr/local/bin/python setup.py install --prefix=/mnt/@server/export
97
In either case, the :option:`--prefix` option defines the installation base, and the :option:`--exec-prefix` option defines the platform-specific installation base, which is used for platform-specific files. (Currently, this just means non-pure module distributions, but could be expanded to C libraries, binary executables, etc.) If :option:`--exec-prefix` is not supplied, it defaults to :option:`--prefix`. Files are installed as follows:
98
:file:`{prefix}/bin`
99
:file:`{prefix}/share`
100
There is no requirement that :option:`--prefix` or :option:`--exec-prefix` actually point to an alternate Python installation; if the directories listed above do not already exist, they are created at installation time.