Package: virtualenv-pyenv
virtualenv-pyenvAvirtualenvPython discovery plugin forpyenv–installed interpretersInstallationpipinstallvirtualenv-pyenvUsageThe Python discovery mechanism can be specified by:the CLI option--discovery:virtualenv--discoverypyenv-p3.10testenvthe environment variableVIRTUALENV_DISCOVERY:exportVIRTUALENV_DISCOVERY=pyenv
virtualenv-p3.10testenvtheconfigoptiondiscovery:[virtualenv]discovery=pyenvvirtualenv-p3.10testenvthevirtualenvwrapperenvironment variableVIRTUALENVWRAPPER_VIRTUALENV_ARGS:exportVIRTUALENVWRAPPER_VIRTUALENV_ARGS='--discovery=pyenv'mkvirtualenv-p3.10testenvOperation ModeThe plugin supports several operation modes. The operation mode affects various aspects of the discovery process.modespecifierpath specifierfallback tobuiltincompatoptionalallowednofallbackoptionalallowedyesstrictrequirederrornoThe mode is specified as a part of the discovery method name:pyenv-{mode}, e.g.,virtualenv--discovery=pyenv-fallback-p3.10testenvorexportVIRTUALENV_DISCOVERY=pyenv-strict
virtualenv-p3.10testenvIf no mode is specified, thecompatmode is used, that is,--discovery=pyenvis the same as--discovery=pyenv-compat.Thecompatmode is recommended for most cases. It mimics closely thebuiltindiscovery plugin to maximize compatibility with existing tools (e.g.,build,tox):if no specifier is provided, the plugin falls back tosys.executable, even if it is not installed by pyenv;if a path specifier (-p /path/to/bin/python) is provided, the path is used, even if it is not installed by pyenv;otherwise (-p 3.7,-p py37), only pyenv–installed interpreters are used.Thefallbackmode is the same ascompat, but in addition falls back to thebuiltinplugin if no interpreter was found. If multiple specifiers are provided, all of them are tried first before falling back to thebuiltinplugin as a last resort.Thestrictmode, as its name suggests, ensures that only pyenv–installed interpreters are used:a specifier is required,sys.executableis never used as a fallback, even if it is installed by pyenv (may be relaxed in the future);a path specifier is not allowed, even if the path points to a pyenv–installed interpreter (may be relaxed in the future);no fallback to thebuiltinplugin.Python Specifier FormatThe plugin supports two specifier formats informally called “pyenv-style” and “virtualenv-style”.The version part of both specifier formats can contain one (major), two (major.minor), or three (major.minor.patch) components. When a one–component version is specified, the latest installed final minor release is selected, ignoring pre–/dev–release. When a two–component version is specified, the latest installed final patch release is selected, ignoring pre–/dev–releases. When a three–component version is specified, the exact final release is selected, ignoring pre–/dev–releases. The pre–/dev–release version is selected only if it is explicitly requested.installedrequestedselected3.9.5;3.9.17,3.10.033.10.03.9.5;3.9.17,3.10.03.93.9.173.9.5;3.9.17,3.10.03.9.53.9.53.9.5;3.9.17,3.10.03.9.0—3.12-dev;3.12.0b33.12—3.12-dev;3.12.0b33.12.0—3.12-dev;3.12.0b33.12-dev3.12-dev3.12-dev;3.12.0b33.12.0b33.12.0b3pyenv–styleThe same format as used bypyenv(pyenv install --list).a final version with 1 version component:3a final version with 2 version components:3.11a final version with 3 version components:3.11.2a pre–release version:3.13.0a4,3.12.0b3,3.11.0rc1a dev version:3.13-devvirtualenv–styleThe same format as used byvirtualenv(docs). A subset of this format is used bytox(docs).a relative or absolute path:/path/to/bin/python(it can be any Python interpreter, not only installed by pyenv)a final version with 1 version component:py3,python3,cpython3,python3-32,py3-64a final version with 2 version components:311,py311,py3.11,python311,cpython3.11,python3.11-32,py311-64a final version with 3 version components:py3.11.2,python3.11.2,cpython3.11.2,python3.11.2-32,py3.11.2-64LimitationsOnly CPython is supported at the moment.Thearchitecturepart (-32/-64) of a specifier is ignored. For example, all of the following specifiers match any installed CPython 3.8.1 regardless of the architecture:python3.8.1,python3.8.1-32,python3.8.1-64.Internalsvirtualenv-pyenv does not rely on pyenv to discover Python interpreters, that is, it never calls any pyenv command and does not require pyenv to be inPATH. Instead, the plugin usespyenv-inspectlibrary, which, in turn, inspects$PYENV_ROOT/versionsdirectory contents.