From 0688b17cc15201248194d57248339041a6939bdd Mon Sep 17 00:00:00 2001 From: sandipanpanda <87253083+sandipanpanda@users.noreply.github.com> Date: Sun, 3 Oct 2021 01:45:18 +0530 Subject: [PATCH] Add documentation for exec command (#2090) --- COMMANDS.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/COMMANDS.md b/COMMANDS.md index 0a55f21c..97d31721 100644 --- a/COMMANDS.md +++ b/COMMANDS.md @@ -16,6 +16,7 @@ The most common subcommands are: * [`pyenv versions`](#pyenv-versions) * [`pyenv which`](#pyenv-which) * [`pyenv whence`](#pyenv-whence) +* [`pyenv exec`](#pyenv-exec) * [`pyenv root`](#pyenv-root) * [`pyenv prefix`](#pyenv-prefix) * [`pyenv hooks`](#pyenv-hooks) @@ -282,6 +283,21 @@ Lists all Python versions with the given command installed. 2.7.6 3.3.3 +## `pyenv exec` + + `Usage: pyenv exec [arg1 arg2...]` + +Runs an executable by first preparing PATH so that the selected Python +version's `bin` directory is at the front. + +For example, if the currently selected Python version is 3.9.7: + + `pyenv exec pip install -r requirements.txt` + +is equivalent to: + + `PATH="$PYENV_ROOT/versions/3.9.7/bin:$PATH" pip install -r requirements.txt` + ## `pyenv root` Displays the root directory where versions and shims are kept.