Python virtualenv

By Sachin
March 4, 2014

setv: Lightweight Python virtual environment manager

Update[March 30, 2016]: I created setV as a separate project with installer and readme. This post is quite old.

I like to have a separate virtualenv for each python project. This ends up having virtual-environments for each project that I often find difficult to manage. All my virtual-environments resides in ~/virtualenvs directory but to activate/deactivate a virtual environment every time is a tedious job.

An easy solution to this is to install virtualenvwrapper, but then I have run commands like workon & mkvirtualenv. I don’t want to do that. Can I manage virtual environment using single command?. Luckily I have Bash function I find very handy. It lists all available virtual environments and can switch the environment as needed.


  • List all virtual environment

      setv [TAB] [TAB]
      setv -l
  • Switch virtual environment

    for example:
      setv rango
  • Create new virtual environment

    for example:
      setv -n foobar
  • Delete existing virtual environment

    for example:
      setv -d foobar
  • Deactivate virtual environment



The script is available here and can be downloaded via wget



  • Set VIRTUAL_DIR_PATH value to your virtual environments directory-path in file. By default it is set to ~/virtualenvs/

  • Create a directory to hold all virtual environments

      mkdir ~/virtualenvs
  • Added this line to your .bashrc or any local rc script.

      source /path/to/