Skip to content

Instantly share code, notes, and snippets.

@stevenheidel
Last active March 3, 2020 03:47
Show Gist options
  • Save stevenheidel/0790a6ef36bd49b8e58df0e310657c2e to your computer and use it in GitHub Desktop.
Save stevenheidel/0790a6ef36bd49b8e58df0e310657c2e to your computer and use it in GitHub Desktop.
Using pyenv
# INSTALLATION
# Step 1: Install pyenv
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
# This will output some instructions to add a few lines to
# your ~/.bash_profile file. Once you've done that
# then open a new terminal window to continue.
# Step 2: Install some versions of Python
# This will take a few minutes
pyenv install 3.6.3
pyenv install 2.7.14
pyenv rehash # or open a new terminal window again
# Step 3: Set your global default version of Python
# This will make "python" and "python3" run Python 3.6.3
# "python2" can be used to run Python 2.7.14
pyenv global 3.6.3 2.7.14
# WITHIN A PROJECT
# Step 1: Create a virtualenv with your project name
pyenv virtualenv pyquil
# Step 2: Set this virtualenv to be the default for the project
pyenv local pyquil
# Done! This creates a ".python-version" file in your project
# Now, whenever you cd into the directoy, pyenv will automagically
# switch to that environment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment