Installing Virtualenv (Pyenv) with Python 3.5 on Ubuntu

Linux already comes with python 2.7 installed, and in this tutorial we will update it to version 3.5.0, it is easy you just need to follow this steps:

Check python version on Terminal ( Ctrl + Alt + T open terminal)

python -V

Installing the pyenv

curl -L | bash

Install dependencies before pyenv

sudo apt-get update && sudo apt-get upgrade sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev git

Add to ~/.bashrc at the end of file

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

Test with the command(you may need to restart terminal):

pyenv versions
 * 3.5.0 (set by /home/{user}/.pyenv/version)

Install python on pyenv

pyenv install 3.5.0

Set Python 3.5 as global pyenv

pyenv global 3.5.0

Check if version 3.5.0 is selected with the command

pyenv versions

Test the python version with:

python -V

Congratulations you have Python 3.5.0 configured on your machine!

Like what you read? Give Tiago Almeida a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.