Skip to content

Instantly share code, notes, and snippets.

@miku
Forked from eliangcs/pyenv+virtualenv.md
Last active January 15, 2018 13:17
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 miku/99494a5091fb8f100202336f14d8c54c to your computer and use it in GitHub Desktop.
Save miku/99494a5091fb8f100202336f14d8c54c to your computer and use it in GitHub Desktop.
Cheatsheet: pyenv, virtualenvwrapper, and pip

Cheatsheet: pyenv, virtualenvwrapper, and pip

Installation (for Mac OS)

Install pyenv with brew

brew update
brew install pyenv

Add the following line to ~/.bash_profile:

eval "$(pyenv init -)"

Install pyenv-virtualenvwrapper

brew install pyenv-virtualenvwrapper
pyenv virtualenvwrapper

Add the following to ~/.bash_profile:

export PYENV_VIRTUALENVWRAPPER_PREFER_PYVENV="true"

Restart your shell or source your profile:

source ~/.bash_profile

Usage

List available Python versions you can install:

pyenv install --list

Install a Python version

pyenv install 2.7.8
pyenv install 3.4.1

See what Python versions you have installed:

pyenv versions

Switch Python versions globally or locally:

pyenv global 2.7.8
pyenv local 2.7.8

Create a virtualenv:

mkvirtualenv my-venv

Install a package with pip:

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