To install Python on Ubuntu, follow these steps:
Step 1: Update Package List
Open a terminal and run the following command to update your package list:
sudo apt update
Step 2: Install Python 3
Ubuntu usually comes with Python pre-installed. You can check if it’s already installed by running:
python3 –version
If Python is not installed or you want to install a different version, run the following command:
sudo apt install python3
Step 3: Install pip
(Python package manager)
pip
is the Python package installer. You can install it with:
sudo apt install python3-pip
Step 4: Verify the Installation
To verify the installation of Python and pip, run:
python3 –version
pip3 –version
This should show you the installed versions of Python and pip.
Step 5: (Optional) Install Additional Development Tools
If you plan to develop with Python, you might also want to install some additional tools:
sudo apt install python3-dev
Step 6: (Optional) Install Virtual Environment Tools
You might want to create isolated environments for Python projects. Install venv
and virtualenv
: