apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-devgit clone https://github.com/pyenv/pyenv.git ~/.pyenvadd pyenv command into path
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bash_profilerestart shell, then enjoiy the pyenv
exec "$SHELL"see all versions which are able to install
pyenv install --listpick one to install
pyenv install 3.5-devinstall it with shared libs
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.5-dev
success ouput
Cloning https://github.com/python/cpython...
Installing Python-3.5-dev...
Installed Python-3.5-dev to /home/ubuntu/.pyenv/versions/3.5-dev