Upgrading python 3.5 to python 3.6 - Ubuntu

11,046

Solution 1

Following command worked for me:

sudo apt-get -f upgrade python3.6

Solution 2

follow below steps:-

sudo add-apt-repository ppa:jonathonf/python-3.6

sudo apt-get update

sudo apt-get install python3.6

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6

Solution 3

Answers here seem a bit out of date, mainly because the PPA no longer exists. This is what worked for me (relying on one of the links posted in some of the question comments, among others):

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

(now we have both versions, need to switch the "toggle")

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 0

Mind the trailing 0.

Share:
11,046

Related videos on Youtube

Shivkumar Mallesappa
Author by

Shivkumar Mallesappa

Updated on June 04, 2022

Comments

  • Shivkumar Mallesappa
    Shivkumar Mallesappa almost 2 years

    This is the first time I am working with python. I am using ubuntu 16.04 system. I am trying to change default python 3.5 to python 3.6 I am following this link to achieve this.

    But I am getting the following error when I fire the command :

    sudo update-alternatives --config python3
    

    Error : bash: /usr/bin/python3: Too many levels of symbolic links

    Please refer the screenshot of the steps which I followed and the commands that are executed. I have first fired update and upgrade command.

    enter image description here enter image description here

    I am not able to understand root cause of the issue, since I am new to python and its environment.

    Thank you

    • Harsha Biyani
      Harsha Biyani over 5 years
    • Bartłomiej
      Bartłomiej over 5 years
      There is some circular symlink. See unix.stackexchange.com/q/141436/226403
    • Shivkumar Mallesappa
      Shivkumar Mallesappa over 5 years
      @Bartłomiej : Thank you for your response. I understand that there is some issue with symlink , but I am not able to understand which symlink is causing this issue , which one I should use and which one I should remove. Could you please throw some light on this for me to understand this in a bit detail.
    • Bartłomiej
      Bartłomiej over 5 years
      @Shivkumar Mallesappa, Sorry, I do not know full solution, that is why I just put a comment, not an answer, hoping that it might be useful.
    • michael_heath
      michael_heath over 5 years
      The link in the question has a update at the bottom of the article about removing and creating the symlink that causes issue. update-alternatives is possibly finding an invalid link so you may need to manually use rm and ln to fix.
    • Kashif
      Kashif about 4 years
      check this maybe helpfull for you stackoverflow.com/questions/21690009/…
  • Miron
    Miron about 4 years
    Cannot add PPA: 'ppa:~jonathonf/ubuntu/python-3.6'. ERROR: '~jonathonf' user or team does not exist. This is all I see.
  • Mohit  Khandelwal
    Mohit Khandelwal almost 4 years
    Got following error after running this command : E: Unable to locate package python3.6