# Get your python 3.11.9 back on Linux

First of all, Select the required python version (Example: 3.11.9)

[https://www.python.org/ftp/python/3.11.9/](https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tar.xz)

Now, Install all the required dependencies to compile and install Python 3.11.9

```bash
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
```

Download and extract 3.11.9 by using wget command.

```bash
wget https://www.python.org/ftp/python/3.11.9/Python-3.11.9.tar.xz
```

Extract it

```bash
tar -xf Python-3.11.9.tgz
```

Configure the build with optimization flags:

```bash
cd Python-3.11.9 && ./configure --enable-optimizations
```

Build Python using multiple processors to speed up the process and Install Python 3.11.9 on your system:

```bash
make -j$(nproc) && sudo make altinstall
```

Check if the python version 3.11 is installed

```bash
python3.11 --version
```

Set Python 3.11 as the Default To conveniently access Python 3.11 using below command

```bash
nano ~/.zshrc
```

Add the following line at the end of the .zshrc file and save it.

```bash
alias python3='/usr/local/bin/python3.11'
```

Also refresh the .zshrc via source comand

```bash
source ~/.zshrc
```

Verify the Default Python Version Check the Python version using the `python3` command:

```bash
python3 --version
```
