workon Verified current stable Not installed? Package Management

Workon / Activate Virtualenv

Activate Virtualenv

Activate an existing Python virtual environment.

$
Terminal
workon <virtualenv_name>

When To Use

Before running scripts that depend on packages installed in a specific virtual environment.

Pro Tip

Use `deactivate` to exit the current environment; check for activated virtualenv in shell prompt.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
workon <virtualenv_name>

Anatomy of Output

Understanding the result

Activating virtual environment 'myenv'... Activation Info

Indicates the specific environment being activated.

PATH=/home/user/.virtualenvs/myenv/bin:$PATH Updated PATH

Updates shell PATH variable to prioritize virtualenv binaries.

(myenv) user@hostname:~$ Shell Prompt

Prompt reflects that myenv is now active.

Power User Variants

Optimized versions

workon myenv --quiet

Activate without displaying messages.

workon --all

List all available virtual environments before activation.

Troubleshooting

Common pitfalls

Error: Environment 'myenv' does not exist

Solution: Check if the environment was created using mkvirtualenv.

Error: Script not found in /home/user/.virtualenvs/myenv/bin/activate

Solution: Verify the virtual environment was created successfully.

Error: Permission denied

Solution: Check permissions for the virtualenv directory.

Command Breakdown

What each part is doing

workon
Base Command
The executable that performs this operation. Here it runs Workon before the shell applies any redirect operators.
<virtualenv_name>
virtualenv name
The value supplied for virtualenv name.

Alternative Approaches

Comparable commands in other tools

Alternative package management tools for the same job.