A step-by-step guide for beginners and experts alike!
Learn how to check if Python is installed on your Raspberry Pi device and what version you have installed. This guide covers both terminal commands and the GUI method using Preferences. …
Updated September 17, 2023
Learn how to check if Python is installed on your Raspberry Pi device and what version you have installed. This guide covers both terminal commands and the GUI method using Preferences.
Terminal Method
- Open a terminal window by clicking
Ctrl + Alt + T
or navigating to Menu > Accessories > Terminal. - Type the following command and press Enter:
python3 --version
- If Python is installed, you will see the version number displayed in the terminal like this:
Python 3.7.3
- If Python is not installed, you will get an error message similar to:
bash: python3: command not found
- Open a terminal window by clicking
GUI Method (using Preferences)
- Open the Raspberry Pi configuration tool by clicking the Raspberry Pi icon in the top-left corner of the screen and selecting
Preferences
. - Navigate to the
Interfaces
tab. - Look for an option labeled
Python 3
under the headingActive Peripherals
. If Python is installed, it will be checked; if not, it will be unchecked.
- Open the Raspberry Pi configuration tool by clicking the Raspberry Pi icon in the top-left corner of the screen and selecting
To install Python on your Raspberry Pi if it isn’t already installed, run the following command in the terminal:
sudo apt-get update && sudo apt-get upgrade && sudo apt-get install python3
This command updates your package lists and installs the latest version of Python 3. Once installation is complete, you can verify it by running python3 --version
again in the terminal.
Note: If you want to use Python 2 instead of Python 3, replace all instances of python3
with python
in the above commands and steps. However, it’s recommended to use Python 3 as Python 2 has reached its end-of-life and is no longer supported.