[Python-Dev] Python install layout and the PATH on win32

VanL van.lindberg at gmail.com
Tue Mar 13 20:43:27 CET 2012


Following up on conversations at PyCon, I want to bring up one of my 
personal hobby horses for change in 3.3: Fix install layout on Windows, 
with a side order of making the PATH work better.

Short version:

1) The layout for the python root directory for all platforms should be 
as follows:

stdlib = {base/userbase}/lib/python{py_version_short}
platstdlib = {base/userbase}/lib/python{py_version_short}
purelib = {base/userbase}/lib/python{py_version_short}/site-packages
platlib = {base/userbase}/lib/python{py_version_short}/site-packages
include = {base/userbase}/include/python{py_version_short}
scripts = {base/userbase}/bin
data = {base/userbase}

2) On Windows, the python executable (python.exe) will be in the "bin" 
directory. That way the installer can optionally add just that directory 
to the PATH to pick up all python-related executables (like pip, 
easy_install, etc).

I have talked with a number of people at PyCon, including Tarek and MvL. 
Nobody objected, and several thought it was a good idea.

Long version:

As a bit of background,the layout for the Python root directory is 
different between platforms, varying in capitalization ("Include" vs. 
"include") and sometimes in the names of directories used ("Scripts" on 
Windows vs. "bin" most everywhere else). Further, the python version may 
or may not be included in the path to the standard library or not.

In times past, this layout was driven by an INSTALL_SCHEMES dict deep in 
the guts of distutils, but with distutils2 it has been lifted out and 
placed within a config file (sysconfig.cfg). [1]

Proposal #1 above deals with this inconsistency [1]. More concretely, it 
also makes it so that I can check in an entire environment into source 
control and work on it cross platform.

As an additional wrinkle on Windows, the main python binary (python.exe) 
is placed in the python root directory, but all associated runnable 
files are placed in the "Scripts" directory, so that someone who wants 
to run both Python and a Python script needs to add both $PYTHON_ROOT 
and $PYTHON_ROOT/Scripts to the PATH.

To add just a little more complication, the python binary is placed 
within the binaries directory when a virtualenv is created, leading to 
an inconsistency between regular python installs and virtualenvs.

Proposal #2 again provides consistency between virtualenvs and regular 
Python installs, and on windows it allows a single directory to be 
placed on the PATH to get all python-related binaries to run.

[1] 
https://bitbucket.org/tarek/distutils2/src/6c3d67ed3adb/distutils2/_backport/sysconfig.cfg
[2] It may be a foolish consistency, but I have a little mind.

Thanks, Van




More information about the Python-Dev mailing list