From f3316ca675fada57bdf862d7e3aebfd6bb5ac02c Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Thu, 11 Jun 2026 08:38:03 +0200 Subject: [PATCH] [3.15] gh-136880: Add warning about PYTHONPATH (GH-151098) (GH-151299) (cherry picked from commit 84630e2cb90ef334e41eb9bccd860b3b0a7ff51b) --- Doc/tutorial/venv.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Doc/tutorial/venv.rst b/Doc/tutorial/venv.rst index f362e1943b66..6b6b8a768e3f 100644 --- a/Doc/tutorial/venv.rst +++ b/Doc/tutorial/venv.rst @@ -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 -- 2.47.3