From 184be5d489dc312558fc053c5753e41469440ad8 Mon Sep 17 00:00:00 2001 From: Alex Corcoles Date: Fri, 1 Mar 2024 20:48:46 +0100 Subject: [PATCH] Be more clear about the lack of necessity of activate --- programming/python/python_modules_primer.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/programming/python/python_modules_primer.md b/programming/python/python_modules_primer.md index 8932c19..d80b96d 100644 --- a/programming/python/python_modules_primer.md +++ b/programming/python/python_modules_primer.md @@ -260,7 +260,10 @@ $ . /bin/activate , and thus if you run `python`, `/bin/python` will be executed instead of `/usr/bin/python`. Besides changing your prompt to indicate the virtual environment is activated, `activate` only alters your `PATH`. -You can never use `activate` if you always specify the path to the virtual environment commands. +`activate` is not mandatory to use a virtual environment. +For example, when running the Python command, if you specify the path of the Python executable in a virtual environment, the command will execute as if the virtual environment had been activated. +Tools such as `poetry` have commands such as `poetry run` that can run commands inside a virtual environment without activating it. +Activation can save time, but it is also more error-prone than more explicit means of using virtual environments. ## Further reading -- 2.47.3