Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Doc/using/windows.rst

    r2 r391  
    4848      by Richard Dooling, 2006
    4949
    50    `Installing on Windows <http://diveintopython.org/installing_python/windows.html>`_
     50   `Installing on Windows <http://diveintopython.net/installing_python/windows.html>`_
    5151      in "`Dive into Python: Python from novice to pro
    52       <http://diveintopython.org/index.html>`_"
     52      <http://diveintopython.net/index.html>`_"
    5353      by Mark Pilgrim, 2004,
    5454      ISBN 1-59059-356-1
     
    8484settings in Windows.
    8585
     86
     87.. _setting-envvars:
    8688
    8789Excursus: Setting environment variables
     
    159161:file:`C:\\Python\\Lib\\site-packages\\`.
    160162
    161 .. `` this fixes syntax highlighting errors in some editors due to the \\ hackery
    162 
    163 You can add folders to your search path to make Python's import mechanism search
    164 in these directories as well.  Use :envvar:`PYTHONPATH`, as described in
    165 :ref:`using-on-envvars`, to modify :data:`sys.path`.  On Windows, paths are
    166 separated by semicolons, though, to distinguish them from drive identifiers
    167 (:file:`C:\\` etc.).
    168 
    169 .. ``
    170 
    171 Modifying the module search path can also be done through the Windows registry:
    172 Edit
    173 :file:`HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\{version}\\PythonPath\\`,
    174 as described above for the environment variable :envvar:`%PYTHONPATH%`.  A
    175 convenient registry editor is :program:`regedit` (start it by typing "regedit"
    176 into :menuselection:`Start --> Run`).
     163This is how :data:`sys.path` is populated on Windows:
     164
     165* An empty entry is added at the start, which corresponds to the current
     166  directory.
     167
     168* If the environment variable :envvar:`PYTHONPATH` exists, as described in
     169  :ref:`using-on-envvars`, its entries are added next.  Note that on Windows,
     170  paths in this variable must be separated by semicolons, to distinguish them
     171  from the colon used in drive identifiers (``C:\`` etc.).
     172
     173* Additional "application paths" can be added in the registry as subkeys of
     174  :samp:`\\SOFTWARE\\Python\\PythonCore\\{version}\\PythonPath` under both the
     175  ``HKEY_CURRENT_USER`` and ``HKEY_LOCAL_MACHINE`` hives.  Subkeys which have
     176  semicolon-delimited path strings as their default value will cause each path
     177  to be added to :data:`sys.path`.  (Note that all known installers only use
     178  HKLM, so HKCU is typically empty.)
     179
     180* If the environment variable :envvar:`PYTHONHOME` is set, it is assumed as
     181  "Python Home".  Otherwise, the path of the main Python executable is used to
     182  locate a "landmark file" (``Lib\os.py``) to deduce the "Python Home".  If a
     183  Python home is found, the relevant sub-directories added to :data:`sys.path`
     184  (``Lib``, ``plat-win``, etc) are based on that folder.  Otherwise, the core
     185  Python path is constructed from the PythonPath stored in the registry.
     186
     187* If the Python Home cannot be located, no :envvar:`PYTHONPATH` is specified in
     188  the environment, and no registry entries can be found, a default path with
     189  relative entries is used (e.g. ``.\Lib;.\plat-win``, etc).
     190
     191The end result of all this is:
     192
     193* When running :file:`python.exe`, or any other .exe in the main Python
     194  directory (either an installed version, or directly from the PCbuild
     195  directory), the core path is deduced, and the core paths in the registry are
     196  ignored.  Other "application paths" in the registry are always read.
     197
     198* When Python is hosted in another .exe (different directory, embedded via COM,
     199  etc), the "Python Home" will not be deduced, so the core path from the
     200  registry is used.  Other "application paths" in the registry are always read.
     201
     202* If Python can't find its home and there is no registry (eg, frozen .exe, some
     203  very strange installation setup) you get a path with some default, but
     204  relative, paths.
    177205
    178206
     
    267295`source <http://python.org/download/source/>`_. You can download either the
    268296latest release's source or just grab a fresh `checkout
    269 <http://www.python.org/dev/faq/#how-do-i-get-a-checkout-of-the-repository-read-only-and-read-write>`_.
     297<http://docs.python.org/devguide/setup#checking-out-the-code>`_.
    270298
    271299For Microsoft Visual C++, which is the compiler with which official Python
Note: See TracChangeset for help on using the changeset viewer.