summaryrefslogtreecommitdiffstats
path: root/Doc/using
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2015-02-26 22:25:33 (GMT)
committerSteve Dower <steve.dower@microsoft.com>2015-02-26 22:25:33 (GMT)
commit76998fef2ced3dfbd62a3047f40312e3fff3ac26 (patch)
tree096c7a02da01620f4e6e243fbe5d52b41a631b86 /Doc/using
parentb48af340b9e6c8775fb9da9cab06e922d0bd0127 (diff)
downloadcpython-76998fef2ced3dfbd62a3047f40312e3fff3ac26.zip
cpython-76998fef2ced3dfbd62a3047f40312e3fff3ac26.tar.gz
cpython-76998fef2ced3dfbd62a3047f40312e3fff3ac26.tar.bz2
Issue #23465: Implement PEP 486 - Make the Python Launcher aware of virtual environments (patch by Paul Moore)
Diffstat (limited to 'Doc/using')
-rw-r--r--Doc/using/windows.rst20
1 files changed, 20 insertions, 0 deletions
diff --git a/Doc/using/windows.rst b/Doc/using/windows.rst
index af66196..f0f24e8 100644
--- a/Doc/using/windows.rst
+++ b/Doc/using/windows.rst
@@ -404,6 +404,16 @@ If you see the following error, you do not have the launcher installed:
Per-user installations of Python do not add the launcher to :envvar:`PATH`
unless the option was selected on installation.
+Virtual environments
+^^^^^^^^^^^^^^^^^^^^
+
+If the launcher is run with no explicit Python version specification, and a
+virtual environment (created with the standard library :mod:`venv` module or
+the external ``virtualenv`` tool) active, the launcher will run the virtual
+environment's interpreter rather than the global one. To run the global
+interpreter, either deactivate the virtual environment, or explicitly specify
+the global Python version.
+
From a script
^^^^^^^^^^^^^
@@ -478,6 +488,16 @@ be used by the launcher without modification. If you are writing a new script
on Windows which you hope will be useful on Unix, you should use one of the
shebang lines starting with ``/usr``.
+Any of the above virtual commands can be suffixed with an explicit version
+(either just the major version, or the major and minor version) - for example
+``/usr/bin/python2.7`` - which will cause that specific version to be located
+and used.
+
+The ``/usr/bin/env`` form of shebang line has one further special property.
+Before looking for installed Python interpreters, this form will search the
+executable :envvar:`PATH` for a Python executable. This corresponds to the
+behaviour of the Unix ``env`` program, which performs a :envvar:`PATH` search.
+
Arguments in shebang lines
--------------------------