how to install python on ubuntu pyenv
# You need these dependencies for pyenv to work.
sudo apt-get update;
sudo apt-get install make build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
# Runs a script that installs pyenv
curl https://pyenv.run | bash
# Exports the path through these lines into .bashrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init --path)"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
# Make the pyenv available without needing to close terminal
exec $SHELL
pyenv update
which pyenv
# You're ready to run!
pyenv install --list
pyenv install 2.7.18
pyenv install 3.7.0
pyenv help global
pyenv global 2.7.15 3.7.0