1

I have installed python 3.6 in an Ubuntu 16.04 platform that had previously python 3.5

now if I check the installed version I have:

ls -l /usr/bin/python*
lrwxrwxrwx 1 root root       9 Nov 24  2017 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root       9 Nov 24  2017 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3492656 Nov 12 19:46 /usr/bin/python2.7
lrwxrwxrwx 1 root root      33 Nov 12 19:46 /usr/bin/python2.7-config -> x86_64-linux-gnu-python2.7-config
lrwxrwxrwx 1 root root      16 Nov 24  2017 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root       9 Mar 23  2016 /usr/bin/python3 -> python3.5
-rwxr-xr-x 2 root root 4464368 Nov 12 16:27 /usr/bin/python3.5
-rwxr-xr-x 2 root root 4464368 Nov 12 16:27 /usr/bin/python3.5m
-rwxr-xr-x 2 root root 4719712 Dec 25 04:54 /usr/bin/python3.6
-rwxr-xr-x 2 root root 4719712 Dec 25 04:54 /usr/bin/python3.6m
lrwxrwxrwx 1 root root      10 Mar 23  2016 /usr/bin/python3m -> python3.5m
lrwxrwxrwx 1 root root      16 Nov 24  2017 /usr/bin/python-config -> python2.7-config

However if I check the version that is running is:

python3 --version
Python 3.5.2

The same in the jupyter notebook

enter image description here

How can I set Python 3.6.7 as default instead of Python 3.5.2?

13
  • Try sudo update-alternatives --config python3.
    – Jos
    May 9, 2019 at 8:55
  • 2
    @Jos I would oppose updating alternatives because some packages strictly depends on Python 3.5 and updating alternatives can break things up. Need to look at some other workaround
    – Kulfy
    May 9, 2019 at 9:01
  • You are right, but then it would have been slightly risky to install Python 3.6 in the first place. In this case, I suppose OP needs to use a full path to the 3.6.7 executable?
    – Jos
    May 9, 2019 at 9:12
  • I agree with Kulfy, you should under no circumstances change what the system's python3 executable points to, that would break many applications. You can still manually run Python 3.6 with the command python3.6 instead of python3, or you can make a Bash alias like alias py='python3.6' if you want to save you some typing.
    – Byte Commander
    May 9, 2019 at 9:25
  • 1
    @Jos Downloading and changing symlinks are two independent things. Downloading might not break things but symlinks can. Python3 is symlink to Python3.5
    – Kulfy
    May 9, 2019 at 9:31

0

Browse other questions tagged or ask your own question.