]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.11] gh-88452: Add a warning about non-portability of environments. (GH-98155)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 10 Oct 2022 20:10:04 +0000 (13:10 -0700)
committerGitHub <noreply@github.com>
Mon, 10 Oct 2022 20:10:04 +0000 (21:10 +0100)
Doc/library/venv.rst

index 3fa1046ae979b65d3854678807b093760b2360b0..3bed25645a9271905308f7fb4ac5bf0d28eea1d6 100644 (file)
@@ -85,6 +85,19 @@ Creating virtual environments
    without there needing to be any reference to its virtual environment in
    ``PATH``.
 
+.. warning:: Because scripts installed in environments should not expect the
+   environment to be activated, their shebang lines contain the absolute paths
+   to their environment's interpreters. Because of this, environments are
+   inherently non-portable, in the general case. You should always have a
+   simple means of recreating an environment (for example, if you have a
+   requirements file ``requirements.txt``, you can invoke ``pip install -r
+   requirements.txt`` using the environment's ``pip`` to install all of the
+   packages needed by the environment). If for any reason you need to move the
+   environment to a new location, you should recreate it at the desired
+   location and delete the one at the old location. If you move an environment
+   because you moved a parent directory of it, you should recreate the
+   environment in its new location. Otherwise, software installed into the
+   environment may not work as expected.
 
 .. _venv-api: