Installing Python 3.13 on Raspberry Pi and Ubuntu

Installing Python 3.13 on Raspberry Pi and Ubuntu

Manually and Easily!

Hey there, fellow Python enthusiasts! 🐍 You’ve probably noticed that staying on top of the latest Python versions can be a bit of a hassle, especially on systems like Raspberry Pi and Ubuntu. Fear not—your favorite Python nerd (that’s me!) is here to help.

Today, I’ll guide you through two ways to get Python 3.13 running on your system:

  1. The manual way (for those who love getting their hands dirty).

  2. The easy way (for those who love saving time and their sanity, thanks to my script).

So grab your coffee ☕ and let’s dive in!


Why Python 3.13?

Python 3.13 brings a boatload of performance improvements, new features, and syntax tweaks to make our lives as developers easier. Whether you’re coding web apps, tinkering with machine learning, or automating your smart home, keeping Python updated means staying ahead of the curve.

But here’s the catch: system default Python versions are often outdated. You don’t want to be stuck with Python 3.7 when 3.13 is out there waiting for you, do you? Let’s fix that.


Option 1: Manual Installation of Python 3.13

This is the classic, old-school way. It works every time but can be a bit tedious if you’re not used to terminal commands. Don’t worry—I’ve got you covered.

Step 1: Check Your Current Python Version

Before anything else, check your current Python version to see what you’re working with:

python3 --version

If it’s not 3.13, let’s change that!


Step 2: Update Your System

We need to ensure your system is up to date before installing a shiny new Python version:

sudo apt update && sudo apt upgrade -y

Step 3: Install Build Tools

Building Python from source requires some dependencies. Install them with:

sudo apt install -y build-essential zlib1g-dev uuid-dev liblzma-dev lzma-dev \
libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev \
libffi-dev libsqlite3-dev libbz2-dev wget checkinstall

Step 4: Download Python 3.13 Source Code

Grab the latest Python 3.13 tarball from the official Python website:

wget https://www.python.org/ftp/python/3.13.0/Python-3.13.0.tar.xz

Step 5: Extract the Source

Unpack the tarball:

tar -xf Python-3.13.0.tar.xz
cd Python-3.13.0

Step 6: Build and Install Python

Run these commands to configure, build, and install Python 3.13:

./configure --enable-optimizations
make -j$(nproc)
sudo make altinstall

Why altinstall? This avoids overwriting the system’s default Python version, which might still be needed by core applications.


Step 7: Verify Installation

Once installed, verify your shiny new Python version:

python3.13 --version

🎉 Congrats! You’ve manually installed Python 3.13. But let’s be honest—this process is long and error-prone. What if there’s an easier way? Well, spoiler alert: there is.


Option 2: The Easy Way with My Script

Let’s face it, not everyone loves manually building Python. That’s where my Easy Python Installer Script saves the day.

Why Use My Script?

  • Simplicity: One command does it all.

  • Safety: Doesn’t overwrite your default system Python.

  • Speed: Automates the boring parts so you can focus on coding.

  • Flexibility: Works for any Python 3.x version, not just 3.13.


How to Use It

Run this command directly from GitHub:

wget -qO - https://raw.githubusercontent.com/tvdsluijs/sh-python-installer/main/python.sh | sudo bash -s 3.13.0

How It Works

  • Step 1: The script checks your current Python version.

  • Step 2: It updates your system to avoid dependency issues.

  • Step 3: It downloads and builds Python from the official source.

  • Step 4: It safely installs the new version without touching your system’s default Python.

That’s it. No fuss, no errors, just Python 3.13 running smoothly.


Why Star My Repo?

Let’s be real—scripts like this don’t grow on trees! It’s been my labor of love, and your support means the world to me. If you find this script helpful:

  1. Star it on GitHub: GitHub Repo

  2. Buy me a coffee:

    Donate

Every star and donation keeps me motivated to build more tools for the community. Let’s make coding easier, together!


Final Thoughts

Python 3.13 is here, and there’s no reason to stay behind. Whether you enjoy tinkering with manual installations or want a no-hassle solution with my script, now you have everything you need to get started.

Have questions or need help? Drop me a line via my contact page, or check out my GitHub repo for updates.

Happy coding! 🚀🐍
— Theo

Did you find this article valuable?

Support itheo.tech, I automate Sh!t by becoming a sponsor. Any amount is appreciated!