Install python 3.6 in Ubuntu

Introduction:

In this blog we will learn how to download and install the python 3.6 in the linux based on ubuntu. We will install the virtual environment and how to create an virtual environment of python 3.6 and also learn how to upgrade the pip.

Step 1: First update and upgrade the system.

sudo apt get update
sudo apt get upgrade

Note: It will ask you to continue press Y to continue the upgradation.

Step 2: Now install prerequisites with 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

Step 3: Now download python 3.6 package.

cd /usr/src
sudo wget https://www.python.org/ftp/python/3.6.10/Python-3.6.10.tgz

Step 4: Extract the downloaded package of python 3.6.

sudo tar xzf Python-3.6.10.tgz

Step 5: After extracting the folder go on extracted folder.

cd Python-3.6.10
sudo ./configure –enable-optimizations
sudo make altinstall

Note: make altinstall command used to prevent replacing the default python binary file /usr/bin/python.

Step 6: Now check the python3 version.

python3.6 -V

Step 7: After installed Python 3.6 upgrade the pip version.

sudo -H pip3 install –upgrade pip

Step 8: Install and create a python environment with the name of env inside a workstation folder.

cd /opt/workstation
sudo -H pip install virtualenv
python3.6 -m venv env 

 

Now we know how to install python3.6, create a virtual environment and how to upgrade the pip version of python.

 

Leave a Reply

Your email address will not be published.