Install Python3.6 on Ubuntu 16.04 LTS
The default python version is 3.5. And if you want to use the version 3.6, it takes times to do it. You could install Python3.6 from a third-party PPA by doing the following steps.
Add the python 3.6 repository
1
sudo add-apt-repository ppa:jonathonf/python-3.6
Check updates and install Python3.6 via commands
1
2sudo apt-get update
sudo apt-get install python3.6After this, you could find out the specified details of the python you’ve installed with the following commands
1
python3.6 -V
The latest version should be 3.6.7 (Installation date is 2019.02.14)
To make
python3
use the new installed python3.6 instead of the default 3.5, run following commands1
2sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 2Finally switch between the two python version for
python3
via command1
sudo update-alternatives --config python3
After selecting version 3.6
1
python3 -V
Reference: How to Install Python 3.6.1 in Ubuntu 16.04 LTS
Problems
Q:
It shows the following errorpip3 command not found
, but the python3-pip has been already installed.
Solution:
If this happens, you could reinstall pip3 via following commands1
2sudo apt-get remove python3-pip
sudo apt-get install python3-pipReference: pip3 command not found