This paper is recorded in Ubuntu 16.04 Admiral python Upgrade to 3.8 edition , And configured as the system default python3 Process of .
stay Ubuntu 16.04 in ,python3 The default version of is 3.5:
$ python3 -V
Python 3.5.2
In this paper Ubuntu 16.04 As an example , The method also applies to Ubuntu 18.04 .
2. adopt Apt install
Ubuntu official apt Not included in the library python 3.8, Use here deadsnakes PPA Library installation .
2.1. Install dependent packages
$ sudo apt update
$ sudo apt install software-properties-common
2.2. add to deadsnakes PPA source
$ sudo add-apt-repository ppa:deadsnakes/ppa
Press [ENTER] to continue or Ctrl-c to cancel adding it.
2.3. install python 3.8
$ sudo apt install python3.8
$ python3.8 -V
Python 3.8.2
3. to configure python3.8 It is the system default python3
3.1. take python Add versions to update-alternatives
$ which python3.8
/usr/bin/python3.8
$ sudo update-alternatives --install /usr/bin/python3 python3
/usr/bin/python3.8 1
$ which python3.5
/usr/bin/python3.5
$ sudo update-alternatives --install /usr/bin/python3 python3
/usr/bin/python3.5 2
3.2. to configure python3 Default pointing python3.8
$ sudo update-alternatives --config python3
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.5 2 auto mode
1 /usr/bin/python3.5 2 manual mode
2 /usr/bin/python3.8 1 manual mode
Press to keep the current choice[*], or type selection number: 2
choice / input 2, enter .
3.3 test python edition
$ python3 -V
Python 3.8.2
Technology