14

I recently updated my Raspberry Pi with sudo apt update and sudo apt full-upgrade to the system. Even if Python 3.8 is out, when I run python3 in terminal, it shows me version 3.7, instead of 3.8.

Why is this the case?

3
  • 3
    Because that is what is available in the default repos. It takes time for a package to go from release to inclusion in the repos, and hence available for install. Aug 12, 2020 at 19:07
  • Cool. You can leave an answer if you wish :) Aug 12, 2020 at 19:28
  • 1
    If you want 3.8 you will have to compile from source or wait for Bullseye - probably mid 2021, but a Raspberry Pi release is unlikely before end 2021. See wiki.debian.org/Python
    – Milliways
    Aug 13, 2020 at 7:35

2 Answers 2

28

Why? Just because it takes a while for distributions to integrate new versions.

Here's what I did to install Python 3.8.5 on my rpi:

sudo apt-get install -y build-essential tk-dev libncurses5-dev \
libncursesw5-dev libreadline6-dev libdb5.3-dev libgdbm-dev libsqlite3-dev \
libssl-dev libbz2-dev libexpat1-dev liblzma-dev zlib1g-dev libffi-dev

version=3.8.5

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

tar zxf Python-$version.tgz
cd Python-$version
./configure --enable-optimizations
make -j4
sudo make altinstall

Installs Python into /usr/local/bin

3
  • You remind me last time I upgraded my jessie python 3.5.3 to 3.7.3. I needed to upgrade because I wanted to learn tensorflow which at that time only supported python 3.7. At that time I had 10 years expereince in Wi95/XT/ .. Win7, and I knew all the batch commands like CD (change directory, make directory, copy/remove files, zip/unzip files etc), so I though I was knowledge enough to do the python 3.7 upgrade. But then I did not know what were tar, zxf, tgz, ... So it took me more than 4 hours (yes 4 hours) to mess up jessie. Fortunately I had a micro SD backup of jessie. My lesson learnt, ..
    – tlfong01
    Aug 13, 2020 at 0:33
  • 3
    Cheers, copy paste friendly galore. Takes about 10min to compile, which is pretty fast and as mentioned it won't override the default Python's symlink or anything, but instead create a completely separate /usr/bin/python3.8 along side whatever is already there. Might get issues later in life when Debian* decides to upgrade finally.
    – Torxed
    Nov 8, 2020 at 18:59
  • How do you activate 3.8 once everything compiles? Does the pi need to be rebooted? If I do a python3 --version its still 3.7
    – bbartling
    Oct 18, 2021 at 18:18
1

This is worth sharing, someone made a bash script.

Ultimate Python installation on a Raspberry Pi & Ubuntu Script

This seems like an interesting site: https://itheo.tech/ultimate-python-installation-on-a-raspberry-pi-ubuntu-script

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.