Ubuntu – How to install Python 3.6 using apt-get

aptpython3software installation

I've tried the normal way, sudo apt-get install python3.6, but… well… that didn't work.

So, how would I go about it? (I'd preferably not build it on my own)

I'm using Ubuntu 16.04.

Best Answer

  • Ubuntu 14.04 (Trusty) and 16.04 (Xenial)

    If you are using Ubuntu 14.04 or 16.04, you can use Felix Krull's deadsnakes PPA at https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa:

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

    J Fernyhough's PPA (at https://launchpad.net/~jonathonf/+archive/ubuntu/python-3.6) used to be an alternative option, but he has shut it down to protest against (ab)use.

    Ubuntu 16.10 and 17.04

    If you are using Ubuntu 16.10 or 17.04, then Python 3.6 is in the universe repository, so you can just run:

    sudo apt-get update
    sudo apt-get install python3.6
    

    After installation for Ubuntu 14.04, 16.04, 16.10 and 17.04

    To invoke the Python 3.6 interpreter, run python3.6.

    Ubuntu 17.10, 18.04 (Bionic) and onwards

    Ubuntu 17.10 and 18.04 already come with Python 3.6 as default. Just run python3 to invoke it.

  • Related Question