Using pyenv for Python projects
Table of Contents
Using pyenv to manage your virtual environments makes working on multiple projects, each using a different version of python a breeze.
I do all my development on an Apple Macbook running Yosemite and my production environment is a VPS from Linode running CentOS 7.
Here some simple notes on how I setup and use pyenv :
Installing on Mac OS X
Install using homebrew
Update your shell profile (.bashrc or .zshrc) adding the following to it (and restart your terminal)
if ; then ; fi
if ; then ; fi
Installing on Linux CentOS 7
Checkout from github
Update your shell profile (.bashrc or .zshrc) adding the following to it (and restart your terminal)
Using pyenv
To install a new version of Python
To get a list of Python versions available
To create a new virtual environment
To use your new virtual environment within your project
- Change to your projects root directory
- Run:
Note that this is done only the first time you go to your project directory. The wonderful thing about pyenv is in future when you change directory to your project directory, it will be automatically activated your virtualenv for you.