With Anaconda, we can create virtual environments with different Python versions. This can be very handy when certain package only supports certain Python versions.
This article shows you the simple guide of creating different environments.
You can install the individual edition from this website: https://www.anaconda.com/products/individual.
Once installed, open CMD.exe Prompt from the navigator.
Create virtual environments
The following commands create three environments with different Python versions:
conda create -n py37 python=3.7
conda create -n py38 python=3.8
conda create -n py39 python=3.9
The above command lines create three environments named py37, py38 and py39 with python versions 3.7, 3.8 and 3.9 respectively.
You can use conda activate $environment_name to activate environments.
conda activate py37
The above command line activate virtual environment named py37.
To deactivate, simply run the following command and Anaconda Prompt will switch back to the default environment:
Install package using the following command line:
conda install package_name
You can also install pip in the environment and then use pip to install packages.