Hello Everyone this is a simple guide on how to quickly set up python on a mac and be able to switch between versions using pyenv!
First Note that all Mac OS come with Python 2.7 out the gate which can be helpful to learn but You might want to use Python 3 for more serious development!
This Blog will help you set this up in a quick and simple fashion!
You will first need homebrew installed to be able to install everything straight from terminal.
just copy and paste this into your terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Now we will install pyenv to help us manage and install different versions of Python, the pyenv docs describe its functionality as
"pyenv lets you easily switch between multiple versions of Python. It’s simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well."
brew install pyenv
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
## List of Python versions
You can look at a list of all the different python versions that can be installed using the command `pyenv install --list`
## Installing Selected Version
Once you have selected a version you want to use install it using the command `pyenv install <version>`
## Viewing all installed versions
You can look at the list of all installed versions of python using the command `pyenv versions`
## Setting Global Version
Set the global or default python version using the command `pyenv global <version>`
## Setting Local Version
Set the local version for the repo by cd'ing into the repo then using the command `pyenv local <version>`
## Checking Current Version in user
You can always check what version of Python is currently being used
by using the command
pyenv is a great tool to use to easily manage and switch between Python
for more about pyenv look at their documentation here :