]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-136880: Add warning about PYTHONPATH (GH-151098) (GH-151298)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 11 Jun 2026 06:38:47 +0000 (08:38 +0200)
committerGitHub <noreply@github.com>
Thu, 11 Jun 2026 06:38:47 +0000 (07:38 +0100)
(cherry picked from commit 84630e2cb90ef334e41eb9bccd860b3b0a7ff51b)

Doc/tutorial/venv.rst

index 91e4ce18acef1dd8c390aedd41829ded0205a21e..4eee4ac5f5facd143786d3a62cb62866b866787a 100644 (file)
@@ -88,6 +88,11 @@ For example:
   '~/envs/tutorial-env/lib/python3.5/site-packages']
   >>>
 
+Note that the activated virtual environment does not alter the ``PYTHONPATH`` variable in any way.
+This may lead to unexpected results if the path includes references to code which is incompatible with
+the Python version the virtual environment is using. The best practice is to ``unset PYTHONPATH``
+in bash or the equivalent for the shell you are using.
+
 To deactivate a virtual environment, type::
 
     deactivate