Install latest Python version on Raspberry Pi

In this tutorial, you have learned to install Python 3.11 on Debian Linux systems using source code.

Quick start

  1. Go to official Python download page and Find latest available Python version
  2. download  Python-3.11.3.tgz
  3. Unpack Python-3.11.3.tgz
  4. Make & Install it

 

Quick start detail

cd /

#Download Python 3.11.3 source
sudo wget https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tgz

#Unpack it
sudo tar -xzf Python-3.11.3.tgz



#Make & Install it
cd Python-3.11.3

./configure --enable-loadable-sqlite-extensions

make -j 4

sudo make install

 

Quick start step by step

step 1.Find already installed Python versions

root@raspberrypi:~# python3 -V
Python 3.10.9
root@raspberrypi:~# python -V
Python 2.7.13

Find and install latest available Python version

Go to official Python download page and look under "Looking for a specific release?" section.

The latest Python source code is available here.https://www.python.org/downloads/release/python-3114/

Python download page:https://www.python.org/ftp/python/

https://www.python.org/downloads/source/

https://www.python.org/ftp/python/3.11.3/

python-releases-1.png

Index of /ftp/python/
../
3.10.7/                                            06-Sep-2022 22:06                   -
3.10.8/                                            11-Oct-2022 17:32                   -
3.10.9/                                            06-Dec-2022 21:19                   -
3.11.0/                                            24-Oct-2022 19:32                   -
3.11.1/                                            06-Dec-2022 21:13                   -
3.11.2/                                            08-Feb-2023 09:57                   -
3.11.3/  (click here)                              05-Apr-2023 11:18                   -
3.12.0/                                            22-May-2023 19:27                   -
...

Select your Python version in the list.

Index of /ftp/python/3.11.3/
../
amd64/                                             05-Apr-2023 00:29                   -
arm64/                                             05-Apr-2023 00:29                   -
win32/                                             05-Apr-2023 00:29                   -
Python-3.11.3.tar.xz                               04-Apr-2023 22:39            19906156
Python-3.11.3.tar.xz.asc                           04-Apr-2023 22:39                 833
Python-3.11.3.tar.xz.crt                           04-Apr-2023 22:39                1071
Python-3.11.3.tar.xz.sig                           04-Apr-2023 22:39                 141
Python-3.11.3.tar.xz.sigstore                      04-Apr-2023 22:39                5014
Python-3.11.3.tgz (here)                           04-Apr-2023 22:39            26455738
....

step 2.Unpack & Make & Install it

 

cd /
sudo wget https://www.python.org/ftp/python/3.11.3/Python-3.11.3.tgz

#Unpack it
sudo tar -xzf Python-3.11.3.tgz

# restart to free memory
reboot

#Make & Install it
cd Python-3.11.3
./configure --enable-loadable-sqlite-extensions
make -j 4
sudo make install

output

Length: 26455738 (25M) [application/octet-stream]
Saving to: ‘Python-3.11.3.tgz’

...
gcc -pthread -c -I./Modules/expat -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall    -std=c11 -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror=implicit-function-declaration -fvisibility=hidden  -I./Include/internal  -I. -I./Include    -fPIC -o Modules/expat/xmlparse.o ./Modules/expat/xmlparse.c
...
Following modules built successfully but were removed because they could not be imported:
_sqlite3                                                       

running build_scripts
creating build/scripts-3.11
copying and adjusting /root/Python-3.11.3/Tools/scripts/pydoc3 -> build/scripts-3.11
copying and adjusting /root/Python-3.11.3/Tools/scripts/idle3 -> build/scripts-3.11
copying and adjusting /root/Python-3.11.3/Tools/scripts/2to3 -> build/scripts-3.11
changing mode of build/scripts-3.11/pydoc3 from 644 to 755
changing mode of build/scripts-3.11/idle3 from 644 to 755
changing mode of build/scripts-3.11/2to3 from 644 to 755
renaming build/scripts-3.11/pydoc3 to build/scripts-3.11/pydoc3.11
renaming build/scripts-3.11/idle3 to build/scripts-3.11/idle3.11
renaming build/scripts-3.11/2to3 to build/scripts-3.11/2to3-3.11

...
Installing collected packages: setuptools, pip
Successfully installed pip-22.3.1 setuptools-65.5.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Step 3.Check if everything is as expected

Verify that the Python-3.11.3 installation is successful by running the python3 -V image

root@raspberrypi:~/Python-3.11.3# python3 -V
Python 3.11.3

 

useful links

https://tecadmin.net/how-to-install-python-3-11-on-debian

https://aruljohn.com/blog/install-python-debian/

Comments


Comments are closed