DEV Community

How to Upgrade to Python 3.7 on Ubuntu 18.04/18.10

Serhat Teker on September 14, 2019

Dev.to version of this article may not be the up-to-date one. You can visit originally published resource: tech.serhatteker.com to see the most rec...
Collapse
 
scottanderson42 profile image
scottanderson42

This breaks apt-get upgrade (and other things) because Ubuntu 18.04 wants Python 3.6 to be the system python. Have you come across this problem?

Collapse
 
serhatteker profile image
Serhat Teker

Sorry to hear that. This was an outdated version of this article. I updated this one as well now.

Also as I mentioned now in the beginning of article you can follow up-to-date version of this article on: tech.serhatteker.com.

Collapse
 
abdvkh profile image
Abubakr Abduvakhidov

yes, how did you solve, could you share because i have problems with apt_

Collapse
 
scottanderson42 profile image
scottanderson42

I upgraded to Ubuntu 20.04. :-P

Collapse
 
begundal_the profile image
slitherin

update-alternatives --set python3 /usr/bin/python3.6

Collapse
 
chbrandt profile image
Carlos H Brandt

You forgot a second step -- maybe related to some crashes from some comments.
Notice that you have python*-config files in there too:

$ ls -lh /usr/bin/python*
lrwxrwxrwx 1 root root    9 Apr 16  2018 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root    9 Apr 16  2018 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3.5M Feb 27 16:10 /usr/bin/python2.7
lrwxrwxrwx 1 root root    9 May 28  2019 /usr/bin/python3 -> python3.6
-rwxr-xr-x 2 root root 4.4M Jan 26 16:33 /usr/bin/python3.6
lrwxrwxrwx 1 root root   33 Jan 26 16:33 /usr/bin/python3.6-config -> x86_64-linux-gnu-python3.6-config
-rwxr-xr-x 2 root root 4.4M Jan 26 16:33 /usr/bin/python3.6m
lrwxrwxrwx 1 root root   34 Jan 26 16:33 /usr/bin/python3.6m-config -> x86_64-linux-gnu-python3.6m-config
-rwxr-xr-x 1 root root 5.0M Feb 25 23:10 /usr/bin/python3.8
lrwxrwxrwx 1 root root   33 Feb 25 23:10 /usr/bin/python3.8-config -> x86_64-linux-gnu-python3.8-config
lrwxrwxrwx 1 root root   16 Oct 25  2018 /usr/bin/python3-config -> python3.6-config
Enter fullscreen mode Exit fullscreen mode

. AFAIU one should also apply a switch to python3-config.

In Step-2, I would recommend also doing:

$ sudo update-alternatives --install /usr/bin/python3-config python3-config /usr/bin/python3.6-config 1
$ sudo update-alternatives --install /usr/bin/python3-config python3-config /usr/bin/python3.8-config 2
Enter fullscreen mode Exit fullscreen mode

, and set accordingly (as explained in the article), but now for python3-config:

$ sudo update-alternatives --config python3-config
Enter fullscreen mode Exit fullscreen mode

Hope that is right and to complement the nice article.
/.\

Collapse
 
voon_leo profile image
Leo Voon

Thank you 😄

Collapse
 
peter279k profile image
peter279k

Thanks. It's clear and useful :).

Collapse
 
sirenaalycewd profile image
Sirena Alyce Web Design

this was a HUGE help...thank you!

Collapse
 
serhatteker profile image
Serhat Teker

Thanks!

Collapse
 
rezach_10 profile image
Anthony Shayesteh

Life Saver 5/5

Collapse
 
yell0wturtle profile image
yell0wturtle

Clean, easy, 5/5.

Collapse
 
serhatteker profile image
Serhat Teker

Thank you.

Collapse
 
amit_savani profile image
Amit Patel

It works! Thanks!

Collapse
 
avstark profile image
akhil

This works, however, after I close the terminal, I can't open it again.
To get it back I have to do:
sudo ln -sf /usr/bin/python3.6 /usr/bin/python3
in the xterm terminal.

Collapse
 
serhatteker profile image
Serhat Teker

Thank you!

Collapse
 
spiritupbro profile image
spiritupbro

thanks man

Collapse
 
wdrfree profile image
wdrfree

Not work for me!!!

Collapse
 
aricjoshua profile image
aricjoshua

Thanks for the information cookie clicker 2

Collapse
 
jalunzano profile image
Labi Luba • Edited

Protecting Legal Rights: Fraud victims must be vigilant about protecting their rights throughout the process . A fraud lawyer will ensure that victims are not taken advantage of by the perpetrators or insurance companies, and that their interests are safeguarded at all times. cutt.ly/6eDx5MAh

Collapse
 
rogerioisj profile image
Rogerio Inacio

Nice! thxs