Install pyenv (Arch Linux) and add the paths to $PATH variable
sudo pacman -S pyenv
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.bashrc &&
echo 'eval "$(pyenv init -)"' >> ~/.bashrc &&
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc &&
echo 'PATH=$(pyenv root)/shims:$PATH' >> ~/.bashrc
List available Python versions to install on the system
pyenv install --list
Clone pyenv-virtualenv into pyenv plugins directory
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv
Install a Python version, for example the version 3.8.7
pyenv install 3.8.7
Create a virtualenvironment with the installed version
# pyenv virtualenv <version> <environment name>
pyenv virtualenv 3.8.7 environment387
List the virtualenvs
pyenv virtualenvs
Activate a virtualenv
# pyenv activate <environment name>
pyenv activate environment387
Deactivate a virtualenv
pyenv deactivate
Resources