Basically, In Linux operating system Python is default installed with libraries. In the default version in Ubuntu is 2.7.x version, it is an old version includes older libraries built for Python 2 and Strings are stored in ASCII. Coming to Python 3 latest version new libraries, packages, and Unicode type features are there in Python latest version. So many Python projects depend upon the Python latest version. In this article, we will explain how to update Python 3.x version with the simple command on Linux/Ubuntu operating system.
To check Python version on your Linux/Ubuntu using below command in the terminal:
python
Update Python 3.7 on Ubuntu:
Step 1: First, we need to update Python from 2.7.x version upgrade version 3.7.
sudo apt-get upgrade
Step 2: Here upgraded all Ubuntu services, including python packages, libraries also.
sudo apt-get install python3.7
I tried to update version 3.7 but getting this error:
sreekanth@sreekanth-Inspiron-5537:~$ sudo apt-get install python3.7 Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package python3.7 E: Couldn't find any package by glob 'python3.7' E: Couldn't find any package by regex 'python3.7'
Step 4: When creating the repository using the below command:
sudo add-apt-repository ppa:fkrull/deadsnakes
After also I am getting another error: “This repository is kept for historical purposes, but NOT UPDATED. Please use the new repository at ”
sreekanth@sreekanth-Inspiron-5537:~$ sudo add-apt-repository ppa:fkrull/deadsnakes This repository is kept for historical purposes, but NOT UPDATED. Please use the new repository at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa instead! More info: https://launchpad.net/~fkrull/+archive/ubuntu/deadsnakes Press [ENTER] to continue or ctrl-c to cancel adding it gpg: keyring `/tmp/tmpkz137ylz/secring.gpg' created gpg: keyring `/tmp/tmpkz137ylz/pubring.gpg' created gpg: requesting key DB82666C from hkp server keyserver.ubuntu.com gpg: /tmp/tmpkz137ylz/trustdb.gpg: trustdb created gpg: key DB82666C: public key "Launchpad Old Python Versions" imported gpg: Total number processed: 1 gpg: imported: 1 (RSA: 1) OK
Step 5: After getting the above error, I am trying to add another repository using the below command.
sudo add-apt-repository ppa:deadsnakes/ppa
Step 6: After that install the Python update version:
Python 3.7 Installation:
sudo apt-get install python3.7
Step7: Then open the terminal then use the below command for checking the Python update version:
python3.7