I was trying to set default python version to python3 in Ubuntu 16.04. By default it is python2 (2.7). I followed below steps :
update-alternatives --remove python /usr/bin/python2
update-alternatives --install /usr/bin/python python /usr/bin/python3
but I'm getting the following error for the second statement,
rejeesh@rejeesh-Vostro-1015:~$ update-alternatives --install /usr/bin/python python /usr/bin/python3
update-alternatives: --install needs
Use 'update-alternatives --help' for program usage information.
I'm new to Ubuntu and Idon't know what I'm doing wrong.
解决方案
Open your .bashrc file nano ~/.bashrc. Type alias python=python3 on to a new line at the top of the file then save the file with ctrl+o and close the file with ctrl+x. Then, back at your command line type source ~/.bashrc. Now your alias should be permanent.
EDIT:
For update alternatives, the priority is an integer. The priority represents which program should be the first used. This article sums it all up pretty well.