Get the App
SLTechnology News&Howtos  ›  Development  › 

How to install and uninstall python3.8 under Ubuntu

Shulou Source: shulou.com Published: 2022-06-03 20:11:50 09月24日 Update

This article is about how to install and uninstall Python 3.8 under Ubuntu. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.

Python 3.8 installation

In Ubuntu 16.04, the default version of Python 3 is 3.5:

$ python3 -VPython 3.5.2

This article takes Ubuntu 16.04 as an example, and the same method applies to Ubuntu 18.04.

1. Install Python 3.8 via Apt

Python 3.8 is not included in Ubuntu's official apt library yet, so use the deadsnakes PPA library to install it.

1.1. Install dependency packages

$ sudo apt-get update$ sudo apt-get install software-properties-common

1.2. Add deadsnakes PPA source

$ sudo add-apt-repository ppa:deadsnakes/ppaPress [ENTER] to continue or Ctrl-c to cancel adding it.

1.3. Install Python 3.8

$ sudo apt-get update$ sudo apt-get install python3.8 $python3.8-VPython 3.8.22. Configure python3.8 as the system default python3

Modifying the default python3 will cause various problems such as not opening Terminal. It is recommended not to modify it. See Ubuntu 16.04 TLS for a workaround: Terminal cannot be opened

2.1. Add Python 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

2.2. Configuration python3 default points to python3.8

$ sudo update-alternatives --config python3There 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 modePress to keep the current choice[*], or type selection number: 2

Select/Enter 2, Enter.

2.3 Testing Python versions

$python3-VPython 3.8.2 Second, uninstall python3.81, uninstall python3.8sudo apt-get remove python3.82, uninstall python3.8 and its dependencies sudo apt-get remove --auto-remove python3.83, remove python3.8sudo apt-get purge python3.8orsudo apt-get purge --auto-remove python3.8

Notes:

This method is more thorough in unloading Python, so it is suitable for use when replacing Python versions.

--For children who want to uninstall Python completely, but cannot accept that some Python components cannot be used after complete uninstall, please be cautious!

Thank you for reading! About "How to install and uninstall Python 3.8 under Ubuntu" This article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!

Tags: Version content method more article configuration good practical method official suggestion direction article this method comment see knowledge children's shoes system components Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi MySQL NVidia Linux Docker