Python 3 is the current version of this programming language, and among its standout features is its versatility, especially when looking at its functionality. You can use it with various computing systems to come up with preferred projects.
Python 3 is also beginner-friendly, and you can pick it up as your ideal programming language when you start coding. You need to know that Python 3 is the native language of the Raspbian OS, the operating system of the Raspberry Pi 3 computer.
A Look at the Raspberry Pi 3
The Raspberry Pi 3 is a low-cost single-board computer system, noted for its simplicity. It is the choice for many DIY’ers in crafting various projects, showing its versatility in bringing tasks to life. The Raspberry Pi 3 runs on the Raspbian operating system, which is a Python base.
If you have a coding project, you can bring together the Raspberry Pi 3 and Python 3 to benefit from their simplicity and user-friendliness. Usually, this single board computer comes with the python packages already installed. However, the packages may be old or not suitable for the task you have in mind at times.
In such a situation, you have to install the coding language module on your computer. If you have such concerns, then you are in the right place as we look at how to install python 3 on Raspberry pi 3.
Installing Python 3 on a Raspberry Pi 3
Before you begin the installation process, here is what you will need:
- The Raspberry pi 3 computer.
- External storage media. Preferably a 32GB or 62GB formatted SD card.
- Hardware components such as a keyboard, mouse, and monitor.
- Stable internet connection.
- Power supply.
Step 1: Update Your System
The Raspbian OS should be up to date to perform its functions and support the python packages. The contents on the operating system release file will let you know the state of your operating platform.
Follow this prompt to see if you have the recent version of Raspbian:
cat /etc/os-release
Optionally, you can install the lsb-release package and launch it to see your Raspbian OS version.
Use this command to install this package:
sudo apt-get install lsb_release
lsb_release –a
If the operating system is old, you need to update it. It is a simple procedure, starting by confirming your storage space. You can do it via this prompt:
df –h
If enough, you can now upgrade the system. The prompt below will handle it:
sudo apt-get update
You then upgrade your operating system distribution:
sudo apt-get dist-upgrade
Step 2: Confirm If You Have Pre-Installed Python Packages
As earlier hinted, python is the native language for the Raspbian OS, and there is a chance that the system has pre-installed python modules. You can confirm the presence of the modules from the archives.
To check for the modules you have, you can use the help function. On the python prompt, key in the following command: help(‘’modules’’)
This action will list all the packages installed in your system.
You can also use python-pip, though you need to have additional packages installed.
Use this prompt to check your archives:
sudo apt-get install python-pip
pip freeze
Step 3: Installation via Python Package Index
If the python3 modules are outdated or do not meet your preference, you should install them afresh. You can achieve this via the python package index. The python package index is in the Raspbian system by default, though if it is not present, you can install it using the below command:
sudo apt install Python-pip3
This prompt will install python 3 modules to the system. You can uninstall unwanted packages via: sudo pip3 uninstall
You can also use Piwheels to install the python3 packages, especially if the modules require a compilation code. Piwheels will give you pre-compiled modules that are easy to use and install and work with the Raspberry pi 3 system.
Step 4: Confirming the Packages In Your System
After completing the installation process, you should confirm that the packages are available on your computer. You can do the confirmation by going to the application menu, then utilities, and click on the terminal.
Use this command prompt:
python—version
You will see the default version of the python packages you installed.
Things to Keep In Mind When Installing Python 3 on Your Raspberry Pi 3
For efficiency purposes, you should understand these parameters during the installation of python 3 to your system:
- Go for the latest version of python. Python 3 has different releases, each year having its own. Target the latest version for your system to work effectively. You can use the sudo-apt command to check the version of the module and make the necessary updates.
- The Raspbian operating system should be up to date to support the new python 3 releases. You may use command prompts to check the status of your operating system. If possible, update it then upgrade its distribution for the best service. Older versions may fail to support the new python releases.
- You can save yourself the task of going through the installation process by confirming your archives if you have the python 3 modules.
- Your device needs sufficient storage space, something that you ensure by having a high capacity SD card. A 64GB or 32GB card is an ideal option.
- A stable internet connection is a must to support updates.
Advantages of Python 3
- Python is easy to use and beginner-friendly.
- It is the native language for Raspbian OS; hence, it will work well with Raspberry pi 3 projects.
- The language has a decent collection of useful libraries.
- You can use it with other languages to develop high-end projects.
Conclusion
Python 3 is one of the most reliable languages you can pick, giving you an edge in versatility and user-friendliness. You can use it well with the Raspberry Pi 3, though you have to install it if your system does not have the latest version.
This article highlights the steps to follow in how to install python 3 in Raspberry pi 3. Follow the steps carefully to enjoy the perks of Raspberry Pi 3 running on Python 3.