Install Python 3.5 in Ubuntu 14

Before installing Python 3.5, it is recommended to install build dependencies.So, run the following commands

sudo apt-get install build-essential checkinstall
sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Now download the python 3.5 tar ball


Extract and install

tar -xvf Python-3.5.0.tgz
cd Python-3.5.0
sudo make install

Now type “python3.5”,  you should able to get python 3.5 python command line

root@vm1:~# python3.5
Python 3.5.0 (default, Jul  1 2016, 03:51:38)
[GCC 4.8.4] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

You can have multiple python versions in your machine.So, if you want python2.7(Default), just type “python”, you will get python 2.7 command line.

How to install python modules for specific version

By default when you install any python modules using pip (pip install <Module>), it will install module for default python version. So, in order to install a python module for specific version you can use “pip<VERSION_Python> install <Module>”

pip3.5 install pykube

How to make “python” command to use python3.5

Simple! just alias it!

alias python=python3


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s