pyenv

List available pyenv versions
https://www.python.org/ftp/python/

pyenv install --list

virtualenv

pip install -U virtualenv --user
mkdir -vp ~/test
cd ~/test
virtualenv .venv
source .venv/bin/activate
pip install -U pip
pip install -U python-openstackclient

Pyenv and virtualenv

sudo apt install -y git build-essential libbz2-dev libreadline-dev libssl-dev zlib1g-dev libsqlite3-dev wget curl libncurses5-dev libncursesw5-dev xz-utils libffi-dev liblzma-dev
 
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
git clone https://github.com/pyenv/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
 
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init --path)"\n  eval "$(pyenv init -)"\n  eval "$(pyenv virtualenv-init -)"\nfi' >> ~/.bashrc
 
exec "$SHELL"  # or re-login
 
pyenv install 3.8.12
pyenv local 3.8.12
pyenv virtualenv 3.8.12 kolla-ansible-xena
pyenv activate kolla-ansible-xena
 
pyenv --version
pyenv virtualenvs
pyenv versions
 
pip install -U pip
pip install -U 'ansible<2.10'
pip install -r requirements.txt
# python setup.py install

Links
https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-global
https://github.com/pyenv/pyenv-virtualenv