Skip to content

Instantly share code, notes, and snippets.

@zlove
Last active March 27, 2018 19:24
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 zlove/8533b00523af7d3fb1537a5e47608a6c to your computer and use it in GitHub Desktop.
Save zlove/8533b00523af7d3fb1537a5e47608a6c to your computer and use it in GitHub Desktop.
pyenv and pyenv virtualenv cheatsheet. This is not at all comprehensive - just a reminder for common tasks.
# Show locally installed Python versions. With pyenv virtualenv installed this
# also lists local virtualenvs
pyenv versions
# List Python versions which are available to install
pyenv install --list
# Install Python version 2.7.14. See `pyenv install --list` for available <versions>
pyenv install <version>
# E.g.
pyenv install 2.7.14
# Create a new virtualenv with pyenv virtualenv
pyenv virtualenv <version> <virtualenv name>
# E.g.
pyenv virtualenv 2.7.14 awesome-env
# Configure a directory to automatically activate a virtualenv
cd /path/to/my/repo
echo 'awesome-env' > .python-version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment