0

I am setting up a raspberry pi with OS: Raspbian GNU/Linux 11 (bullseye), and it comes with 3.9.x and I need ver 3.11. Below is what I get when I add the repository (any suggestions what to do here?)

pi@raspberrypi:~ $ sudo add-apt-repository ppa:deadsnakes/ppa Traceback (most recent call last): File "/usr/bin/add-apt-repository", line 95, in <module> sp = SoftwareProperties(options=options) File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 109, in __init__ self.reload_sourceslist() File "/usr/lib/python3/dist-packages/softwareproperties/SoftwareProperties.py", line 599, in reload_sourceslist self.distro.get_sources(self.sourceslist) File "/usr/lib/python3/dist-packages/aptsources/distro.py", line 91, in get_sources raise NoDistroTemplateException( aptsources.distro.NoDistroTemplateException: Error: could not find a distribution template for Raspbian/bullseye 

1 Answer 1

7

Other than relying on APT repository ppa:deadsnakes/ppa, You can go ahead fetching the python 3.11 source code from the python.org using wget

wget https://www.python.org/ftp/python/3.11.4/Python-3.11.4.tgz 

Now install the build tools and git.

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

Configure, make and install

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

This will install Python 3.11 in your Raspberry but in order to make it default, you have to remove the link to /usr/bin/python3 and link python3.11

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

Check the python version by python -VV

Python 3.11.4

Sign up to request clarification or add additional context in comments.

1 Comment

Changing the default Python version could break some systems. I recommend to call it with python3.11 and using virtualenv

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.