How to create a virtual environment for Python 3

TL;DR -> Show me how to create a virtual env

Manjaro was not happy with me using pip globally without a virtual environment, so I had to find out myself how to create one and use it. The following is for future reference.

Creating the virtual environment

mkdir -p $HOME/.venvs  # create a directory for your virtual environments
python3 -m venv $HOME/.venvs/MyExampleEnvironment  # create an environment named MyExampleEnvironment

Installing a package via pip inside of that virtual environment

$HOME/.venvs/MyEnv/bin/python -m pip install package-name

Activating the virtual environment for that shell session

source $HOME/.venvs/MyEnv/bin/activate

Resources

Taken from: Stack Overflow post answer

Reference: Python docs guide for virtual environments