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:
cd

Download the installer script:

wget -O ~/pyenv-installer.sh https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer

Change the permission so that you can run it:

chmod 750 ~/pyenv-installer.sh

Run the installer:

~/pyenv-installer.sh

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 *