Skip to main content

Easy way to use virtualenv.

Project description

https://pypip.in/d/venv/badge.png https://pypip.in/v/venv/badge.png https://pypip.in/license/venv/badge.png

Easy way to use virtualenv.

Features

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

Install

$ pip install --user venv

Quickstart

Initialize an empty virtualenv using venv init:

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

$ ls -A
.venv

Run command inside virtualenv using venv run:

$ venv run which python
~/project/.venv/bin/python

Activate virtualenv in a sub-shell:

$ venv run
$ which python
~/project/.venv/bin/python
$ (Deactivate with Ctrl-D)

Usage

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

  Easy way to use virtualenv

Options:
  --help  Show this message and exit.

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

Caveats

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"
fi

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