Skip to content

Commit 0cba121

Browse files
bpo-37403: Touch up venv docs (GH-14458)
Add a versionadded for PS Core and note that `.venv` is a common virtual environment name. (cherry picked from commit f9f8e3c) Co-authored-by: Brett Cannon <54418+brettcannon@users.noreply.github.com>
1 parent e3761ca commit 0cba121

File tree

2 files changed

+20
-7
lines changed

2 files changed

+20
-7
lines changed

Doc/tutorial/venv.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ This will create the ``tutorial-env`` directory if it doesn't exist,
5050
and also create directories inside it containing a copy of the Python
5151
interpreter, the standard library, and various supporting files.
5252

53+
A common directory location for a virtual environment is ``.venv``.
54+
This name keeps the directory typically hidden in your shell and thus
55+
out of the way while giving it a name that explains why the directory
56+
exists. It also prevents clashing with ``.env`` environment variable
57+
definition files that some tooling supports.
58+
5359
Once you've created a virtual environment, you may activate it.
5460

5561
On Windows, run::

Doc/using/venv-create.inc

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@ command ``venv``::
66
Running this command creates the target directory (creating any parent
77
directories that don't exist already) and places a ``pyvenv.cfg`` file in it
88
with a ``home`` key pointing to the Python installation from which the command
9-
was run. It also creates a ``bin`` (or ``Scripts`` on Windows) subdirectory
10-
containing a copy/symlink of the Python binary/binaries (as appropriate for the
11-
platform or arguments used at environment creation time). It also creates an
12-
(initially empty) ``lib/pythonX.Y/site-packages`` subdirectory
13-
(on Windows, this is ``Lib\site-packages``). If an existing
14-
directory is specified, it will be re-used.
9+
was run (a common name for the target directory is ``.venv``). It also creates
10+
a ``bin`` (or ``Scripts`` on Windows) subdirectory containing a copy/symlink
11+
of the Python binary/binaries (as appropriate for the platform or arguments
12+
used at environment creation time). It also creates an (initially empty)
13+
``lib/pythonX.Y/site-packages`` subdirectory (on Windows, this is
14+
``Lib\site-packages``). If an existing directory is specified, it will be
15+
re-used.
1516
1617
.. deprecated:: 3.6
1718
``pyvenv`` was the recommended tool for creating virtual environments for
@@ -96,12 +97,14 @@ directory containing the virtual environment):
9697
+-------------+-----------------+-----------------------------------------+
9798
| Platform | Shell | Command to activate virtual environment |
9899
+=============+=================+=========================================+
99-
| Posix | bash/zsh | $ source <venv>/bin/activate |
100+
| POSIX | bash/zsh | $ source <venv>/bin/activate |
100101
+-------------+-----------------+-----------------------------------------+
101102
| | fish | $ . <venv>/bin/activate.fish |
102103
+-------------+-----------------+-----------------------------------------+
103104
| | csh/tcsh | $ source <venv>/bin/activate.csh |
104105
+-------------+-----------------+-----------------------------------------+
106+
| | PowerShell Core | $ <venv>/bin/Activate.ps1 |
107+
+-------------+-----------------+-----------------------------------------+
105108
| Windows | cmd.exe | C:\\> <venv>\\Scripts\\activate.bat |
106109
+-------------+-----------------+-----------------------------------------+
107110
| | PowerShell | PS C:\\> <venv>\\Scripts\\Activate.ps1 |
@@ -122,3 +125,7 @@ when the virtual environment is created.
122125
123126
.. versionadded:: 3.4
124127
``fish`` and ``csh`` activation scripts.
128+
129+
.. versionadded:: 3.8
130+
PowerShell activation scripts installed under POSIX for PowerShell Core
131+
support.

0 commit comments

Comments
 (0)