How to Install Python in Ubuntu Linux – ROS 2

install-python-ubuntu

In this tutorial, we’re going to walk through how to install Python on Ubuntu Linux. Whether you’re setting up your development environment for the first time or updating to the latest version, this tutorial will ensure you get Python installed correctly on your system.

Prerequisites

I am going to start by creating a file for all the code I will write in this tutorial.

Open a terminal window.

Type the following commands:

mkdir -p ~/Documents/python_tutorial
cd ~/Documents/python_tutorial

Let’s start by checking which version of Python we have installed.

python3 --version 

Press Enter. 

1-python-version

This command will tell you the version of Python 3 that is currently installed.

If Python 3 is not installed or if you need a different version, we can install it using Ubuntu’s package manager.

sudo apt-get update
sudo apt-get install python3 

If you also need pip, which is the Python package installer, you can install it by typing:

sudo apt install python3-pip 

After the installation has completed, you can verify that Python and pip are installed correctly by repeating the version check for Python and also checking pip by typing:

pip3 --version
2-pip

That’s it. You now have Python and pip installed on your Ubuntu system. With Python set up, you’re ready to start developing applications, including those for robotics projects.

Thanks, and I’ll see you in the next tutorial.