Install latest python version with pyenv

user137369 picture user137369 · Apr 17, 2015 · Viewed 10.9k times · Source

With ruby-install, to install the latest stable ruby version, one needs only ruby-install ruby.

However, with pyenv one seems to need to do something ridiculous like pyenv install $(pyenv install --list | sed 's/^ //' | grep '^\d' | grep --invert-match 'dev\|a\|b' | tail -1).

Is there a better way to do this? Why do python tools seem to always make installing the latest version such an obtuse process compared to ruby (gem update vs pip list --outdated | awk '!/Could not|ignored/ { print $1 }' | xargs pip install --upgrade)? I hope I’m the one missing something, but I can never find easy solutions for this online.

Answer

Dave picture Dave · Apr 4, 2017

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