1

I am trying to use update-alternatives to assign python 3.6 ; Instead it is using python 3.52.

update-alternatives --install /usr/bin/python python /usr/bin/python3 1

Any idea what I have to do differently?

I am following this guide. Python 3.6 was released since it was prepared. I have been unable to achieve this result.

1 Answers1

1

python 3.6.x doesn't come packaged in Ubuntu Xenial release by default (I'm assuming you have Ubuntu 16.04 installed on your machine because you have tagged 16.04 in the question). In Ubuntu 16.04 by default one gets python2.7.12 and python3.5.2

    $ python --version
    Python 2.7.12
    $ python3 --version
    Python 3.5.2

Ubuntu 16.04 provides these two by default and are stable. Even the guide that you have mentioned uses Python3.5.2 and not Python3.6.x

Anyhow if you insist on using 3.6.x, there are three ways to go about it:

You can install Ubuntu 17.10, which by default provides python 3.6.x (I don't recommend this as 17.10 is not LTS)

Or

install it from alternative ppas. See here

Or

You can also compile it from source: visit python3 sources and download source tarball of whichever python3 version you prefer. Once downloaded you can follow: (I'm assuming python3.6.4 here)

    sudo apt-get install build-essential checkinstall
    sudo apt-get install libreadline-gplv2-dev  libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
    cd /usr/src
    sudo wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
    sudo tar xzf Python-3.6.4.tgz
    cd Python-3.6.4
    sudo ./configure --enable-optimizations
    sudo make altinstall

And then use update-alternatives as mentioned in the aforementioned guide (the one you posted in the question); you can also modify the python3 alias to point to Python3.6.x (whichever version you've installed) although I deplore it immensely.

Frankly speaking, I don't see an explicit need to use python 3.6.x for Django (I'm a Django dev myself). Python 3.5.2 should suffice.

Happy coding!