How to install Python 3 to Raspberry Pi

Overview

The goal of this post is to get Python 3 installed on your Raspbian operating system. It takes around 5 minutes to accomplish the instructions.

List of needs

Installation

It might not be necessary to update your Raspbian, but if your Raspbian version is old enough to cause problems, I'd suggest you to give it a few minutes to update your Raspbian. You can use the following code to update your Raspbian:

sudo apt-get update

Once the update process is done, or your Raspbian is already up to date, you can run the following code to start the installation process of Python 3:

sudo apt-get install python3-pip

It might ask you to confirm the additional space usage, you can go ahead and say Yes to it. If everything goes right, you will be ready to use Python 3 on your Raspberry Pi.

If you'd like to give it a shot and try to see if Python 3 is installed properly and compiles as it should, you can run the following command to download a simple hello world code for Python.

wget https://gist.githubusercontent.com/onurtirpan/599795dd04ec3dc0626934a9b77fed14/raw/3d8e6783701b34a705dc3ffe99dbd64d47232fae/python3-hello-world.py
Then, you can use the following code to run the code.
python3 python3-hello-world.py

This is how the process will look: