I am running ubuntu 16.04. Recently I have installed python3.7.3 by running these commands:
sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:deadsnakes/ppa sudo apt update sudo apt install python3.7 after running these commands I typed:
python3.7 it says:
Python 3.7.3 (default, Mar 26 2019, 01:59:45) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.
But the default python in ubuntu still is python3.5. To configure it I am ran the following command in the terminal:
sudo update-alternatives --config python the output of the command is as follows:
There is only one alternative in link group python (providing /usr/bin/python): /usr/bin/python3.5 Nothing to configure.
Any help to resolve this issue is highly appreciated.
Thanks in advance.
11 Answer
After install Python 3.6.x and/or 3.7.x you need to make python3 use the new installed python instead of the default 3.5 release.
Run following commands to add the alternatives:
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2 sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.7 3 Then you can switch between the python versions for python3:
sudo update-alternatives --config python3 BUG: There is a bug for this method: gnome-terminal won’t launch after switch to newer version.
To solve this, you need to recreate the symlink:
sudo rm /usr/bin/python3 sudo ln -s python3.5 /usr/bin/python3 Check version with:
python3 -V 1