Skip to content

Commit 614e3ec

Browse files
authored
gh-124113: Clarify venv target directory reuse (#151419)
* gh-124113: Clarify venv target directory reuse * gh-124113: Refine venv reuse wording * gh-124113: State that --clear also deletes non-venv files
1 parent 4448205 commit 614e3ec

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Doc/library/venv.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ containing a copy or symlink of the Python executable
7777
It also creates a :file:`lib/pythonX.Y/site-packages` subdirectory
7878
(on Windows, this is :file:`Lib\\site-packages`).
7979
If an existing directory is specified, it will be re-used.
80+
Reusing an existing directory does not leave it unchanged: ``venv`` may create,
81+
update, or replace files in the target directory. Use a dedicated directory for
82+
the virtual environment, and avoid placing project files directly inside it.
8083

8184
.. versionchanged:: 3.5
8285
The use of ``venv`` is now recommended for creating virtual environments.
@@ -126,7 +129,9 @@ The command, if run with ``-h``, will show the available options::
126129

127130
.. option:: --clear
128131

129-
Delete the contents of the environment directory if it already exists, before environment creation.
132+
Delete all contents of the environment directory if it already exists,
133+
including files that were not created by ``venv``,
134+
before environment creation.
130135

131136
.. option:: --upgrade
132137

0 commit comments

Comments
 (0)