mkvirtualenv Verified current stable Not installed? Package Management

Mkvirtualenv / Create Virtualenv Basic

Create Virtualenv Basic

Command to create a new Python virtual environment.

$
Terminal
mkvirtualenv <virtualenv_name>

When To Use

When setting up a project requiring isolated Python dependencies.

Pro Tip

Use the `--no-site-packages` flag for full isolation from global site packages.

Command Builder

Tune the command before you copy it

Back to syntax
$
Generated Command
mkvirtualenv <virtualenv_name>

Anatomy of Output

Understanding the result

New virtual environment created at /home/user/.virtualenvs/myenv Creation Confirmation

Confirms successful creation of the virtual environment.

Problem creating /home/user/.virtualenvs/myenv Error

Indicates that the specified directory may not be writable.

Power User Variants

Optimized versions

mkvirtualenv --quiet myenv

Suppress output during environment creation.

mkvirtualenv --no-site-packages myenv

Create with no access to global site packages.

Troubleshooting

Common pitfalls

Error: Command not found: mkvirtualenv

Solution: Check if virtualenvwrapper is installed and sourced in your shell profile.

Error: Virtualenv already exists

Solution: Use `rmvirtualenv myenv` to remove existing instance.

Error: No such file or directory

Solution: Verify that the path given is correct.

Command Breakdown

What each part is doing

mkvirtualenv
Base Command
The executable that performs this operation. Here it runs Mkvirtualenv 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.