Environment: Ubuntu Trusty (14.04), Wily (15.10) & Xenial (16.04)
There're 2 steps.
sudo apt install libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev
Without this step, you'll get some warning message while compiling just like,
WARNING: The Python bz2 extension was not compiled. Missing the bzip2 lib?
WARNING: The Python readline extension was not compiled. Missing the GNU readline lib?
WARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash