# How to re-install Python 3 on Ubuntu

Python can be tricky to work with, especially when avoiding conflicts. You may need to remove all of the Python versions and re-install it.

Let's see how to do it!

> I keep these installation tutorials simple and straightforward because I know how frustrating it is to read through an entire article when you are simply looking for terminal commands. So if this article looks bland, it is very much on purpose :)

## Uninstall Python3

> Uninstall and re-install Python 3 on Ubuntu 20.04 lts.

### List all python versions in default locations

```sh
ls /usr/bin/python* 
```

### Remove just the python3 package

```sh
sudo apt-get remove python3.5
```

### Remove it's dependent packages

```sh
sudo apt-get remove --auto-remove python3.5
```

### Remove the configuration and/or data files of python3

```sh
sudo apt-get purge python3.5
```

### Remove both configuration and/or data files of python3.5 and it's dependencies

```sh
sudo apt-get purge --auto-remove python3.5
```

## Install a new version of python

```sh
sudo apt-get update
```
```sh
sudo apt-get install python3
```

Verify the installation.

```sh
python3
```
You should see something like the following.

```sh
Python 3.10.6 (main, Aug 10 2022, 11:40:04) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
```

## ModuleNotFoundError: No module named '_sqlite3'.

```sh
sudo apt-get install libsqlite3-dev
./configure --enable-loadable-sqlite-extensions && make && sudo make install
```
