lsvirtualenv Verified current stable Not installed? Package Management

Lsvirtualenv / List Virtualenvs

List Virtualenvs

List all existing Python virtual environments.

$
Terminal
lsvirtualenv

When To Use

When assessing available environments for project requirements.

Pro Tip

Use `--quiet` to suppress names for scripting purposes; check if the list is exhaustive by inspecting the .virtualenvs directory.

Anatomy of Output

Understanding the result

Available environments: List Header

Indicates the start of the environment names.

myenv Environment

Name of the available virtual environment.

anotherenv Environment

Another listed virtual environment.

Power User Variants

Optimized versions

lsvirtualenv --abbreviate

Shorten the names displayed in the output.

lsvirtualenv --quiet

Suppress output except for the names.

Troubleshooting

Common pitfalls

Error: No virtualenvs found

Solution: Ensure that virtualenvs have been created beforehand.

Error: Permission denied when accessing .virtualenvs

Solution: Permission on .virtualenvs directory needs to be read access by user.

Error: directory not found

Solution: Confirm that the VIRTUALENVWRAPPER_HOOK_DIR is set correctly.

Command Breakdown

What each part is doing

lsvirtualenv
Base Command
The executable that performs this operation. Here it runs Lsvirtualenv before the shell applies any redirect operators.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.