Install Latest Python (3.7) on Ubuntu via Pyenv

Install different/multiple version of Python

Install pyenv.

curl -L | bash

NOTE: curl | bash is a risky command, make sure to execute them from trusted source only.

Add the following to ~/.bash_profile, ~/.profile or ~/.bashrc.

export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

NOTE: I am using Lubuntu 16.04, and only ~/.bashrc works.

Start a new terminal or run source ~/.bashrc.

Check for update.

pyenv update

Install latest python.

pyenv install 3.7.0

NOTE: Check latest python version

NOTE: Refer to Ubuntu 18.04 Pyenv Build Python 3.7 Common Error.

Check for available versions.

pyenv versions

Create a pyenv virtualenv named test.

pyenv virtualenv 3.7.0 test

Activate virtualenv

pyenv activate test

Deactivate virtualenv

pyenv deactivate

List all virtualenv

pyenv virtualenvs

Delete/Uninstall virtualenv

pyenv uninstall env

NOTE: Refer to Install Python (Make from Source) or apt-get as well.

❤️ Is this article helpful?

Buy me a coffee ☕ or support my work via PayPal to keep this space 🖖 and ad-free.

Do send some 💖 to @d_luaz or share this article.

✨ By Desmond Lua

A dream boy who enjoys making apps, travelling and making youtube videos. Follow me on @d_luaz

👶 Apps I built

Travelopy - discover travel places in Malaysia, Singapore, Taiwan, Japan.