Skip to content

Instantly share code, notes, and snippets.

@dishantsethi
Last active June 2, 2019 09:02
Show Gist options
  • Save dishantsethi/1f641a1c6021a623ccb41fa91edd82c2 to your computer and use it in GitHub Desktop.
Save dishantsethi/1f641a1c6021a623ccb41fa91edd82c2 to your computer and use it in GitHub Desktop.
Virtualenvwrapper commands helps and tips

Virtualenvwrapper commands helps and tips

  • Extension of virtualenv tool
  • organize all virtual environments in one place
  • wrappers for managing virtual environemts(create, delete, copy .. )
  • single command to switch between environments
  • Virtualenvwrapper should be installed into the same global site-packages area where virtualenv is installed

Basic Installation

pip install virtualenvwrapper

or

sudo pip install virtualenvwrapper

Shell Startup file

add following lines to your .bashrc or .profile, to set the location where your virtual environemts should live

export WORKON_HOME=~/Envs
source /path to virtualenvwrapper shell file/virtualenvwrapper.sh

after editing, run source ~/.bashrc to reload.

Quick steps

  • run workon to get a list of environemnts in /Envs folder
  • run mkvirtualenv temp to make and acitivate a new virtualenv names temp
  • run workon env1/env2/env3... to switch between environemnts
  • run deactivate to deactivate environment

List of all environemnts

lsvirtualenv

remove virtal environemnt

rmvirtualenv ENVNAME you must deactivate before removing the current environment

Duplicate a virtual environemnt

cpvirtualenv ENVNAME [TARGETENVNAME]

Run a command in all virtualenvs under WORKON_HOME

allvirtualenv [COMMAND] allvirtualenv pip install -U pip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment