Skip to content

Instantly share code, notes, and snippets.

@ivyleavedtoadflax
Last active November 21, 2017 17:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivyleavedtoadflax/0950214704d1179dfc3caa2d9994ca13 to your computer and use it in GitHub Desktop.
Save ivyleavedtoadflax/0950214704d1179dfc3caa2d9994ca13 to your computer and use it in GitHub Desktop.
How to use pyenv with virtualenvwrapper

Using pyenv with virtualenvwrapper

  • pyenv is used to manage which version of python you are using
  • virtualenv is used to manage python dependencies

They can interact nicely together if you do the following:

Install the required packages (this assumes that you have virtualenv and virtualenvwrapper installed).

Install pyenv and pyenv-virtualenvwrapper

brew install pyenv
brew install pyenv-virtualenvwrapper

Add export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true" to your ~/.bashrc or ~/.zshrc file, then source ~/.zshrc (or ~/.bashrc).

Set up a specific python version

mkdir <dir>
cd <dir>
pyenv install 3.4.6

# Fix local version of Python

pyenv local 3.4.6
mkvirtualenv -a ./ example_virtualenv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment