How to setup and install Python Development environment in Ubuntu?

Introduction of Python Language

Python is a general-purpose and high level programming language. Mainly Python is used for developing websites, web applications, and APIs. It is also widely used to accomplish Data Engineering and AI field tasks.

Prerequisites

  • OS Linux(Ubuntu)
  • A user account with sudo privileges
  • Access to a terminal window/command-line (Ctrl–Alt–T)

Python is already installed in many Linux distributions.it may be python 2 or python 3 depending on python version

To check your Ubuntu version

  1. lsb_release -a

Your version is above Ubuntu 17.10 then most probably you have python 3.6 by default

And your version is Ubuntu 16.10 and 17.04 then most probably you have python 2

But you should able to install python3.6 version you want for that need to follow following command

Installation for Ubuntu 16.10 and 17.04

  1. sudo apt-get update
  2. sudo apt-get install python3.6

If you are using Ubuntu 14.04 or 16.04, Python 3.6 is not in the Universe repository, and you need to get it from a Personal Package Archive (PPA).

Installation for below 16.04

  1. sudo add-apt-repository ppa:deadsnakes/ppa
  2. sudo apt-get update
  3. sudo apt-get install python3.6

For install a specific version of python Do follow following step

  1. Installations

a) wget <path > (for example https://www.python.org/ftp/python/3.6.5/Python-3.9.2.tgz)

b) sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev

2. Configurations

a) sudo apt-get update and

b) sudo apt-get upgrade

3. Build Python

a) tar xvf Python-3.9.2.tgz

b) cd Python-3.9.2

c) /configure — enable-optimizations — with-ensurepip=install

d) make -j 8

e) sudo make altinstall

4. Verify Your Python Install

python3.9 -V

Mobio Solutions is a Business Technology Solutions Company that will guide you with strategic advice on the technology that fits best with your business solution. You can contact and get a 1-week free consultation service from the best technocrat of the team.