Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (50.2k points)
Can anyone tell me how to update Python in Ubuntu?

1 Answer

0 votes
by (108k points)
edited by

For updating Python in Ubuntu, first of all, you need to download PPA as this file is having the current version of Python. To download PPA, you can use the below code:

$ sudo add-apt-repository ppa:deadsnakes/ppa

After downloading and installing PPA, the next thing is to update the packages. For updating, you can execute the below command:

$ sudo apt-get update

Now, the main task is to update the version from Python 2x to Python 3x. You can use the following code for that:

$ sudo apt-get install Python3.6

$ sudo apt-get install Python3.7

After installing Python 3x, now, you should install pip using the below code:

$ sudo apt install Python3-pip

Finally, you have to set the priority for both Python 3.6 and Python 3.7 using the following:

$ sudo update-alternatives --install /usr/bin/Python3 Python3 /usr/bin/Python3.6 1

$ sudo update-alternatives --install /usr/bin/Python3 Python3 /usr/bin/Python3.7 2

If you are looking for an online course to learn Python, I recommend this Python Training program by Intellipaat.

Related questions

0 votes
1 answer
asked Dec 16, 2020 in Python by ashely (50.2k points)
0 votes
1 answer
asked Jul 14, 2020 in Python by ashely (50.2k points)
0 votes
1 answer
asked Jul 13, 2020 in Python by ashely (50.2k points)
0 votes
1 answer
asked Jul 9, 2020 in Python by ashely (50.2k points)
+5 votes
2 answers

Browse Categories

...