Setup/Manage python environments in Mac

There are 3 steps

a. Install pyenv-virtualenv
b. Create an environment
c. Switch to the new environment

1. Install

To setup and manage virtual python environments you would need pyenv-virtualenv

You can install it using:

$brew install pyenv pyenv-virtualenv

2. To see the list of python versions you already have.
$pyenv versions

2. Create an Environment

Then create an environment using this command. Pick any of the python versions you have on your environments.

$pyenv virtualenv 3.8.0 env1

3. Switch

To switch to the newly created environment

$pyenv activate env1