summaryrefslogtreecommitdiffstats
path: root/Doc/library/venv.rst
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2022-10-10 18:27:52 (GMT)
committerGitHub <noreply@github.com>2022-10-10 18:27:52 (GMT)
commit6a757da080121c4add61931ae46389b3f3e990a1 (patch)
tree977db7275b03cb6f98d3d5ffca0f1adcb19983d2 /Doc/library/venv.rst
parent553d3c10172254b190078c50eb9f8e60522c8f41 (diff)
downloadcpython-6a757da080121c4add61931ae46389b3f3e990a1.zip
cpython-6a757da080121c4add61931ae46389b3f3e990a1.tar.gz
cpython-6a757da080121c4add61931ae46389b3f3e990a1.tar.bz2
gh-88452: Add a warning about non-portability of environments. (GH-98155)
Diffstat (limited to 'Doc/library/venv.rst')
-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 0681061..40eccde 100644
--- a/Doc/library/venv.rst
+++ b/Doc/library/venv.rst
@@ -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: