Skip to main content

Easy way to use virtualenv.

Project description

Easy way to use virtualenv.


  • Store virtualenv in .venv directory, kind of like a git repo.
  • Run command inside virtualenv without activating it.


$ pip install --user venv


Initialize an empty virtualenv using venv init:

$ venv init
New python executable in .venv/bin/python
Installing setuptools, pip...done.

$ ls -A

Run command inside virtualenv using venv run:

$ venv run which python

Activate virtualenv in a sub-shell:

$ venv run
$ which python
$ (Deactivate with Ctrl-D)


Usage: venv [OPTIONS] COMMAND [ARGS]...

  Easy way to use virtualenv

  --help  Show this message and exit.

  init  Create a new virtualenv
  run   Run command in virtualenv (default: shell)


Use ‘–’ to separate venv run options and command that contains ‘-‘:

$ venv run -- python --version
Python 2.7.5

oh-my-zsh overwrites $PATH, add the following to your .zshrc:

if [ -n "$VIRTUAL_ENV" ]; then
    export PATH="$VIRTUAL_ENV/bin:$PATH"

Recommanded aliases:

alias vrun='venv run --'
alias vpy='venv run -- python'
alias vpip='venv run -- pip'

Project details

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page