summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-10-10 20:09:27 (GMT)
committerGitHub <noreply@github.com>2022-10-10 20:09:27 (GMT)
commitbf6b52ebade9ed779c0a0482f35cb00e062616b1 (patch)
tree68acfe7f176419200f9879eaad2e58891b146ae3
parent64ce2cba9890b4b8522760090286a756cbefa33f (diff)
downloadcpython-bf6b52ebade9ed779c0a0482f35cb00e062616b1.zip
cpython-bf6b52ebade9ed779c0a0482f35cb00e062616b1.tar.gz
cpython-bf6b52ebade9ed779c0a0482f35cb00e062616b1.tar.bz2
[3.10] gh-88452: Add a warning about non-portability of environments. (GH-98155) (GH-98156)
-rw-r--r--Doc/library/venv.rst13
1 files changed, 13 insertions, 0 deletions
diff --git a/Doc/library/venv.rst b/Doc/library/venv.rst
index 127a871..fe5e4c0 100644
--- a/Doc/library/venv.rst
+++ b/Doc/library/venv.rst
@@ -84,6 +84,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: