LinuxCommandLibrary

pyenv-virtualenv

Manage Python virtual environments with pyenv

TLDR

Create virtualenv

$ pyenv virtualenv [3.11.0] [myproject]
copy
List virtualenvs
$ pyenv virtualenvs
copy
Activate virtualenv
$ pyenv activate [myproject]
copy
Deactivate virtualenv
$ pyenv deactivate
copy
Delete virtualenv
$ pyenv virtualenv-delete [myproject]
copy
Set local virtualenv
$ pyenv local [myproject]
copy
Create with current version
$ pyenv virtualenv [myproject]
copy

SYNOPSIS

pyenv virtualenv [version] name
pyenv activate name
pyenv deactivate

DESCRIPTION

pyenv-virtualenv is a pyenv plugin that manages Python virtual environments alongside pyenv's version management. It creates isolated environments tied to specific Python versions, each with its own independent set of installed packages, and integrates them seamlessly into pyenv's version-switching workflow.
Virtual environments created with this plugin appear as regular pyenv versions and can be activated using pyenv activate or auto-activated by setting a local version with pyenv local. When a .python-version file references a virtualenv name, entering that directory automatically activates the environment and leaving it deactivates, providing a frictionless per-project workflow.

PARAMETERS

virtualenv VERSION NAME

Create new virtualenv.
virtualenvs
List virtualenvs.
activate NAME
Activate virtualenv.
deactivate
Deactivate current.
virtualenv-delete NAME
Delete virtualenv.

CAVEATS

Requires pyenv installed. May need shell integration configured. Slower than venv in some cases.

HISTORY

pyenv-virtualenv was created as a pyenv plugin by the pyenv community. It brings virtualenv management into the pyenv workflow.

SEE ALSO

pyenv(1), virtualenv(1), python(1), pip(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community