pyenv

pyenv lets you easily switch between multiple versions of Python. It's simple, unobtrusive, and follows the UNIX tradition of single-purpose tools that do one thing well.

How to Install Python Using Pyenv

Information Regarding Pyenv

At a high level, pyenv intercepts Python commands using shim executables injected into your PATH, determines which Python version has been specified by your application, and passes your commands along to the correct Python installation.

For more information, visit the pyenv GitHub repository.

Pyenv and Python3 Installation Script

bash <(wget -qO- https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/Language%20Installers/python-pip-install.sh)
source ~/.profile
which python

Pyenv Usage Guide

Listing Installed Python Versions

pyenv versions
ultradocs@pollux:~$ pyenv versions
  system
* 3.9.13 (set by /home/ultradocs/.pyenv/version)
ultradocs@pollux:~$ 

Installing other Python Versions using Pyenv

pyenv install --list | grep -E " 3.[8-9].*| 3.10.*"
ultradocs@pollux:~$ pyenv install --list | grep -E " 3.[8-9].*| 3.10.*"
  3.8.0
  3.8-dev
  3.8.1
  3.8.2
  3.8.3
  3.8.4
  3.8.5
  3.8.6
  3.8.7
  3.8.8
  3.8.9
  3.8.10
  3.8.11
  3.8.12
  3.8.13
  3.9.0
  3.9-dev
  3.9.1
  3.9.2
  3.9.4
  3.9.5
  3.9.6
  3.9.7
  3.9.8
  3.9.9
  3.9.10
  3.9.11
  3.9.12
  3.9.13
  3.10.0
  3.10-dev
  3.10.1
  3.10.2
  3.10.3
  3.10.4
ultradocs@pollux:~$ 
pyenv install -v <version number>

For example: 
pyenv install -v 3.10.4
ultradocs@pollux:~$ pyenv install -v 3.10.4
ultradocs@pollux:~$ pyenv versions
  system
  3.10.4
* 3.9.13 (set by /home/ultradocs/.pyenv/version)
ultradocs@pollux:~$
pyenv global <version>

For example:
pyenv global 3.10.4
ultradocs@pollux:~$ pyenv global 3.10.4
ultradocs@pollux:~$ pyenv versions
  system
* 3.10.4 (set by /home/ultradocs/.pyenv/version)
  3.9.13
ultradocs@pollux:~$ python -V
Python 3.10.4
ultradocs@pollux:~$ 

Uninstalling a Python Version using Pyenv

pyenv uninstall <version>

Example:
pyenv uninstall 3.9.13
ultradocs@pollux:~$ pyenv versions
  system
* 3.10.4 (set by /home/ultradocs/.pyenv/version)
  3.9.13
ultradocs@pollux:~$ pyenv uninstall 3.9.13
pyenv: remove /home/ultradocs/.pyenv/versions/3.9.13? [y|N] y
pyenv: 3.9.13 uninstalled
ultradocs@pollux:~$ 

Uninstall Pyenv and the Python version(s) installed by it

rm -rf ~/.pyenv
nano ~/.profile
source ~/.profile