Give in to Mike Meyer -- add *both* lib/python1.5/packages and

lib/site-python to the path (if they exist).  This is a reasonable
compromise.
This commit is contained in:
Guido van Rossum 1997-09-03 22:05:54 +00:00
parent ad87d3e826
commit f01dff7e93
2 changed files with 40 additions and 18 deletions

View File

@ -9,18 +9,29 @@ modules that needed to use site-specific modules would place
\code{import site} somewhere near the top of their code. This is no
longer necessary.
This will append up site-specific paths to to the module search path.
It starts with \code{sys.prefix} and \code{sys.exec_prefix} (if
different) and appends \file{lib/python\var{version}/packages}. The
resulting directory, if it exists, is added to \code{sys.path}, and
also inspected for path configuration files. A path configuration
file is a file whose name has the form \file{\var{package}.pth}; its
contents are additional directories (one per line) to be added to
\code{sys.path}. Non-existing directories (or non-directories) are
never added to \code{sys.path}; no directory is added to
This will append site-specific paths to to the module search path.
It starts by constructing up to four directories from a head and a
tail part. For the head part, it uses \code{sys.prefix} and
\code{sys.exec_prefix}; empty heads are skipped. For
the tail part, it uses the empty string (on Mac or Windows) or it uses
first \file{lib/python\var{version}/packages} and then
\file{lib/site-python} (on Unix). For each of the distinct head-tail
combinations, it sees if it refers to an existing directory, and if
so, adds to \code{sys.path}, and also inspected for path configuration
files.
\indexii{site-python}{directory}
\indexii{packages}{directory}
A path configuration file is a file whose name has the form
\file{\var{package}.pth}; its contents are additional items (one
per line) to be added to \code{sys.path}. Non-existing items are
never added to \code{sys.path}, but no check is made that the item
refers to a directory (rather than a file). No item is added to
\code{sys.path} more than once. Blank lines and lines beginning with
\code{\#} are skipped.
\index{package}
\indexiii{path}{configuration}{file}
\kwindex{sys.prefix}
\kwindex{sys.exec_prefix}
\kwindex{prefix}

View File

@ -9,18 +9,29 @@ modules that needed to use site-specific modules would place
\code{import site} somewhere near the top of their code. This is no
longer necessary.
This will append up site-specific paths to to the module search path.
It starts with \code{sys.prefix} and \code{sys.exec_prefix} (if
different) and appends \file{lib/python\var{version}/packages}. The
resulting directory, if it exists, is added to \code{sys.path}, and
also inspected for path configuration files. A path configuration
file is a file whose name has the form \file{\var{package}.pth}; its
contents are additional directories (one per line) to be added to
\code{sys.path}. Non-existing directories (or non-directories) are
never added to \code{sys.path}; no directory is added to
This will append site-specific paths to to the module search path.
It starts by constructing up to four directories from a head and a
tail part. For the head part, it uses \code{sys.prefix} and
\code{sys.exec_prefix}; empty heads are skipped. For
the tail part, it uses the empty string (on Mac or Windows) or it uses
first \file{lib/python\var{version}/packages} and then
\file{lib/site-python} (on Unix). For each of the distinct head-tail
combinations, it sees if it refers to an existing directory, and if
so, adds to \code{sys.path}, and also inspected for path configuration
files.
\indexii{site-python}{directory}
\indexii{packages}{directory}
A path configuration file is a file whose name has the form
\file{\var{package}.pth}; its contents are additional items (one
per line) to be added to \code{sys.path}. Non-existing items are
never added to \code{sys.path}, but no check is made that the item
refers to a directory (rather than a file). No item is added to
\code{sys.path} more than once. Blank lines and lines beginning with
\code{\#} are skipped.
\index{package}
\indexiii{path}{configuration}{file}
\kwindex{sys.prefix}
\kwindex{sys.exec_prefix}
\kwindex{prefix}