There are several ways to manage Python versions and Python environments and some of these include
Virtualenv. This blog will focus on the
Virtualenv. According to its online documentation Virtualenv is used to create isolated Python environments. Using a virtual environment helps to keep Python projects isolated and the developer does not have to worry about accidentally changing versions of her libraries, thereby unwittingly breaking her application. Below are some quick steps on how to install and create virtual environments with Virtualenv. You'll need to have Python 3 installed for Virtualenv to work.
Install Virtualenv On MacOS
$ pip install --user virtualenv
Install Virtualenv On Windows
$ pip install virtualenv
Create a Virtual Environment
$ mkdir my_app
Change into your new project directory
$ cd my_app
In the code below we create a virtual environment 'my_app'.
$ python3 -m venv my_app
If you already have python3 installed as your default .
$ virtualenv my_app
Activate your environment, Note: For Windows, leave out the word,
$ source my_app/bin/activate
Dectivate your environment
Create a virtual environment using a specific python version
$ virtualenv -p python3.6 venv