The Ultimate Raspberry Pi Python setup

The Ultimate Raspberry Pi Python setup

It's not only about the OS/Software

Theo van der Sluijs

Published on Dec 21, 2021

5 min read

Subscribe to my newsletter and never miss my upcoming articles

Listen to this article

Yes, the photo of de Desk is mine. I like a clean desk policy, so I do not have a lot of distraction.

Does it always is this clean.... well .... NO! I usualy work at my desk and if work is done things get ugly (or dirty). However I always try to start with a clean desk (or end by cleaning my desk for the next morning).

So that is it! The Ultimate Raspberry Pi and Python setup! Nothing to see no distractions. I have it working, but not on my Desk!

Okay... that was a small inside joke! When I set things up it usually is on my desk. But when ready I put it in my 10Inch server rack.

So let's start with the Ultimate Raspberry Pi Python setup!

Raspberry Pi and Python

The Raspberry Pi is a great tool for learning about computers and programming. With Python, you can start building your own programs without having to learn a complicated programming language. Python is a popular language for beginners because it is easy to read and write. A Raspberry Pi running python gives you access to the internet and can be used as a web server.

Python includes many built-in libraries that make it easier to perform different tasks, such as manipulating images or processing text files. One of the most popular libraries, called NumPy, makes it possible to do complex numerical work like managing matrices and arrays of numbers with ease.

This article aims to provide you with a step-by-step process on how to install Python on your Raspberry Pi.

Raspberry Pi OS

If you already have an OS installed on your Raspberry Pi just skip this section and go to the Installing Python on Raspberry Pi part.

There are a few ways you can install Raspberry Pi OS.

Install Raspberry Pi OS using Raspberry Pi Imager

Raspberry Pi Imager is the easiest and most quickest way to install Raspberry Pi OS and other operating systems to a microSD card, ready to use with your Raspberry Pi.

Just follow the tutorial in this YouTube video.

Download and install Raspberry Pi Imager to a computer with an SD card reader. Put the SD card you'll use with your Raspberry Pi into the reader and run Raspberry Pi Imager.

Download for macOS
Download for Windows
Download for Ubuntu for x86

Manually install an operating system image

Browse a range of operating systems provided by Raspberry Pi and by other organisations, and download them to install manually.

See all download options

Do understand that each Operating System uses it's own way of installing. Please read the install files and try to follow them step by step.

Turn off /disable desktop GUI on Raspberry Pi

For running Python on a Raspberry Pi, you do not need a GUI! Please it's useless to have a gui running when only working with Python. So turn it off.

If you are using Raspbian image on Raspberry Pi, you can use raspi-config, which is a Raspberry Pi configuration command-line tool. Using this tool, you can change boot options which include console booting or graphical desktop login.

Launch raspi-config from a terminal.

sudo raspi-config

Pick the the boot option menu.

Ultimate Python on Raspberry Pi, turn off GUI

Select text console login option.

Disable GUI Raspberry Pi OS for Python usage

Finally, press <TAB> key to move your cursor to Finish, and quit the tool. When prompted to reboot, choose YES to reboot.

Installing Python on Raspberry Pi

So installing python on a Raspberry Pi is really simple. I have created a script (one line) to do all the hard work for you!

You need a few things, either a connection with SSH to your Raspberry Pi or a connected keyboard and monitor to your raspberry pi to see a terminal.

If you want to connect with a terminal to your Raspberry Pi, be sure to have SSH open on your Rasp. If you don't, read this.

Also it's good to have your SSH key placed onto your Raspberry Pi so you cna log in more easily. Read this to add your SSH key to your Rasp.

Open a terminal and connect to your raspberry pi (or open a terminal on Ubuntu if you want to install it on Ubuntu) and simply run this installer by :

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

Fill in the Python version you want at the end where it states _[python_verion] (remove the brackets)_

So, if you want to install version 3.10 do:

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

When this script has run correctly you will see:

Install Python on Raspberry Pi

10 Inch rack with Raspberry Pi and Python

So this part is a little add-on to this article. As said I do not like a cluttered desk to work on, or start working on. I used to have multiple Raspberry Pi's on my Desk but with the (almost) silent fan's blowing and the place it took, I wanted to get rid of them.

So when moving into my current house I've spend a lot of thought and money on how my network and all the devices should look like and put away. In the Netherlands the fuse boxes, or should I say Fuse cabinets are small. You can not really put a 19inch rack in it. But a 10Inch ifts fine!

So I've bought the biggest 10 inch I could find. I've let a guy on etsy 3d print a raspberry pi 1u holder. I placed POE Hat's for my rasp's and placed everything inside the 10inch rack.

It looks like this!

Great setup for Raspberry Pi & Python

So what do you need? (affiliate links ahead!)

  1. 10inch rack
  2. Raspberry Pi POE HAT (v4)
  3. Raspberry Pi 10Inch rack mount 1u

That's it! It's like the Ultimate Raspberry Pi Python hardware setup!

Have Fun and don't forget to Donate :-)

 
Share this