Install latest python version with pyenv
Try https://github.com/momo-lab/pyenv-install-latest
Installation...
git clone https://github.com/momo-lab/pyenv-install-latest.git "$(pyenv root)"/plugins/pyenv-install-latest
Latest 2.7 build of python...
pyenv install-latest 2.7
and for python 3...
pyenv install-latest
Combining this with this answer, another option is:
pyenv install --list | grep --extended-regexp "^\s*[0-9][0-9.]*[0-9]\s*$" | tail -1
The regex looks for lines that start with a number ^[0-9]
, followed by any amount of dots and/or numbers [0-9.]*
, and end with a number [0-9]$
. Leading ^\s*
or trailing \s*$
whitespaces may occur but don't have to.
Edit: to install:
pyenv install $(pyenv install --list | grep --extended-regexp "^\s*[0-9][0-9.]*[0-9]\s*$" | tail -1)