How to Install Python 3.11.4 on the Raspberry Pi

Published July 06, 2023

The default Python version that comes with Raspberry Pi OS (Raspbian) is 3.9.2, and is outdated. I prefer to build and use the latest Python on You can manually install the latest version of Python using these steps.

Python 3.11.4 was released on June 6, 2023. This blog post helps you install Python 3.11.4 on your Raspberry Pi.

Installing Python 3.11.4 on the Raspberry Pi

Why use Python on the Raspberry Pi?

I use Python for various purposes all my Raspberry Pi boards. I run automated scripts, web applications that help in home automation, web controllable Christmas lights and more recently AI/machine learning.

Download Python 3.11.4 source

First, setup Raspberry Pi OS on your microSD card. You can read my previous blog post on how to do it.

Run this command to download the latest Python source code.


Install the build tools

Run these to install the build tools.

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev

If you want, you can install git as well.

sudo apt install git

Configure, make and make install

Run these commands. The configure command may take several minutes depending on your Raspberry Pi. On my Raspberry Pi v3, this took about 10 minutes.

tar -xzvf Python-3.11.4.tgz 
cd Python-3.11.4/
./configure --enable-optimizations
sudo make altinstall

This will install Python at /usr/local/bin/python3.11. To test the version, run this:

/usr/local/bin/python3.11 -V

You will get this output:

Python 3.11.4

Make Python 3.11 the default version

When you run python, you will still get the default 3.9.2.

/usr/bin/python3 -V
Python 3.9.2

To make the default version of Python 3.11.4, run this:

sudo rm /usr/bin/python
sudo ln -s /usr/local/bin/python3.11 /usr/bin/python

Test whether Python 3.11.4 is the default version:

python -VV
Python 3.11.4

Let me know whether you have any problems installing Python 3.11.4 in your Raspberry Pi.

Related Posts

If you have any questions, please contact me at arulbOsutkNiqlzziyties@gNqmaizl.bkcom. You can also post questions in our Facebook group. Thank you.

Disclaimer: Our website is supported by our users. We sometimes earn affiliate links when you click through the affiliate links on our website.

Last Updated: July 06, 2023.     This post was originally written on August 10, 2021.