David - Musings of an SRE

Running virtualenvwrapper with pyenv

Virtualenvwrapper is a great way to manage your different python package environment. How would you then manage the different package environment ontop of your different python environments?

Pyenv-virtualenvwrapper attempts to answer that question by allowing your virtualenvwrapper to be used in conjunction with your pyenv.

If you don’t have virtualenvwrapper or virtualenv installed, don’t fret, you can still follow the tutorial, pyenv-virtualenvwrapper would install all the necessary dependencies.

Prerequisite:

Installation

Installation is pretty quick, just do a simple:

$ git clone https://github.com/yyuu/pyenv-virtualenvwrapper.git ~/.pyenv/plugins/pyenv-virtualenvwrapper

This installs your pyenv-virtualenvwrapper as a plugin.

Configuration

In order to make sure that your shell uses pyenv-virtualenvwrapper as its preference, in your ~/.bash_profile, add the following lines

# ~/.bash_profile
export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"
pyenv virtualenvwrapper

This will allow you to now do all the magical stuff that virtualenvwrapper enables.