Skip to content

Commit a98c3f5

Browse files
authored
Improve activator documentation (#2488)
1 parent ab35ce4 commit a98c3f5

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

docs/user_guide.rst

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -205,28 +205,31 @@ system python's pip before activation, once you do the activation this should re
205205
Note, though that all we do is change priority; so, if your virtual environments ``bin``/``Scripts`` folder does not
206206
contain some executable, this will still resolve to the same executable it would have resolved before the activation.
207207

208-
For a list of shells we provide activators see :option:`activators`. The location of these is right alongside the python
209-
executables ( usually ``Scripts`` folder on Windows, ``bin`` on POSIX), and are named as ``activate`` (and some
210-
extension that's specific per activator; no extension is bash). You can invoke them, usually by source-ing (the source
211-
command might vary by shell - e.g. bash is ``.``):
208+
For a list of shells we provide activators see :option:`activators`. The location of these is right alongside the Python
209+
executables: usually ``Scripts`` folder on Windows, ``bin`` on POSIX. They are called ``activate``, plus an
210+
extension that's specific per activator, with no extension for Bash. You can invoke them, usally by source-ing them.
211+
The source command might vary by shell - e.g. on Bash it’s ``source`` (or ``.``):
212212

213213
.. code-block:: console
214214
215-
source bin/activate
215+
source venv/bin/activate
216216
217-
This is all it does; it's purely a convenience of prepending the virtual environment's binary folder onto the ``PATH``
218-
environment variable. Note you don't have to activate a virtual environment to use it. In this case though you would
219-
need to type out the path to the executables, rather than relying on your shell to resolve them to your virtual
220-
environment.
217+
The activate script prepends the virtual environment’s binary folder onto the ``PATH`` environment variable. It’s
218+
really just convenience for doing so, since you could do the same yourself.
221219

222-
The ``activate`` script will also modify your shell prompt to indicate which environment is currently active. The script
223-
also provisions a ``deactivate`` command that will allow you to undo the operation:
220+
Note that you don't have to activate a virtual environment to use it. You can instead use the full paths to its
221+
executables, rather than relying on your shell to resolve them to your virtual environment.
222+
223+
Activator scripts also modify your shell prompt to indicate which environment is currently active, by prepending the
224+
environment name in brackets, like ``(venv)``. You can disable this behaviour by setting the environment variable
225+
``VIRTUAL_ENV_DISABLE_PROMPT`` to any value.
226+
227+
The scripts also provision a ``deactivate`` command that will allow you to undo the operation:
224228

225229
.. code-block:: console
226230
227231
deactivate
228232
229-
230233
.. note::
231234

232235
If using Powershell, the ``activate`` script is subject to the

0 commit comments

Comments
 (0)