Installing pyenv on Ubuntu

To work with multiple versions of Python, you have a few options. One of them is to use a virtual manager like pyenv.

Steps to install pyenv on Ubuntu

Note: These were tested on Ubuntu 16.04.

Install dependencies

Open a terminal and run:
sudo apt-get install build-essential git libreadline-dev zlib1g-dev libssl-dev libbz2-dev libsqlite3-dev wget

Swtich to your home directory:

Download the installer script:

wget -O ~/

Change the permission so that you can run it:

chmod 750 ~/

Run the installer:


To see all the available versions:
pyenv install --list

Install Python 3.7.1 (If you need it)
pyenv install 3.7.1

Install Python 2.7.15 (If you need it)
pyenv install 2.7.15

Leave a Reply

Your email address will not be published. Required fields are marked *