← 返回命令列表

Linux command

pyenv 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

List available Python versions

pyenv install --list

Install a Python version

pyenv install [3.12.0]

List installed versions

pyenv versions

Set global Python version

pyenv global [3.12.0]

Set local Python version

pyenv local [3.11.0]

Set shell-specific version

pyenv shell [3.10.0]

Unset shell version

pyenv shell --unset

Show current active version

pyenv version

Uninstall a version

pyenv uninstall [3.9.0]

Rehash shims

pyenv rehash

说明

pyenv manages multiple Python installations on a single system. It allows installing different Python versions and switching between them per-project, per-shell, or globally. pyenv works by inserting a directory of shims into PATH. These shims intercept Python commands and redirect them to the appropriate Python version based on configuration hierarchy: shell > local > global. The tool is essential for developers who need to test code against multiple Python versions or work on projects requiring different Python versions.

参数

install _version_
Install a Python version.
uninstall _version_
Remove a Python version.
versions
List installed versions.
version
Show current active version.
global _version_
Set default version.
local _version_
Set version for current directory.
shell _version_
Set version for current shell.
rehash
Rebuild shim executables.
which _command_
Show full path of command.
init
Configure shell for pyenv.
root
Show pyenv installation root.

FAQ

What is the pyenv command used for?

pyenv manages multiple Python installations on a single system. It allows installing different Python versions and switching between them per-project, per-shell, or globally. pyenv works by inserting a directory of shims into PATH. These shims intercept Python commands and redirect them to the appropriate Python version based on configuration hierarchy: shell > local > global. The tool is essential for developers who need to test code against multiple Python versions or work on projects requiring different Python versions.

How do I run a basic pyenv example?

Run `pyenv install --list` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does install _version_ do in pyenv?

Install a Python version.