Installing Python 3.6.8 on Ubuntu: A Step-by-Step Guide

Python (programming language) - Wikipedia

Python is a powerful and versatile programming language, and you might find yourself needing a specific version for your project. In this guide, we'll walk through the steps to install Python 3.6.8 on Ubuntu, a popular Linux distribution.

Prerequisites

Before we begin, ensure that you have the following:

  • Access to a terminal on your Ubuntu machine.
  • Administrative privileges (you can use sudo).

Method 1: Using DeadSnakes PPA

The DeadSnakes Personal Package Archive (PPA) provides newer versions of Python for Ubuntu. Follow these steps:

  1. Update your package list:

        sudo apt update

  Install the required software properties package:

                   

                      sudo apt install software-properties-common

  Add the DeadSnakes PPA:

                       sudo add-apt-repository ppa:deadsnakes/ppa

  Update the package list again:

                    sudo apt update

Install Python 3.6.8:

                     sudo apt install python3.6

 Method 2: Building from Source

Building from source provides more control over the installation process:

  1. Install build dependencies:

  sudo apt update

sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev

  Download the Python 3.6.8 source code:

                      wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz

  Extract the source code:

                                 tar -xzvf Python-3.6.8.tgz

  Navigate to the Python source directory:

                                cd Python-3.6.8

  Configure and build:

                               ./configure

            make

  Install:

                             sudo make install

Verifying the Installation

To verify the installation, run:

                             python3.6 --version

This should display the Python version as 3.6.8.

Conclusion

You have successfully installed Python 3.6.8 on your Ubuntu system. Whether you chose the DeadSnakes PPA or building from source, you now have a specific Python version ready for your projects. Happy coding!

 

Previous Post Next Post