Getting Python set up on Linux Mint is a straightforward process that unlocks a world of development, automation, and data science possibilities. This guide walks through the native package manager method and the more flexible deadsnakes PPA, ensuring you install the specific version you need. The terminal commands are simple, but understanding the options prevents future conflicts.
Why Python on Linux Mint
Linux Mint provides a stable and user-friendly desktop environment, making it an ideal platform for Python development. The operating system comes with essential build tools pre-installed or easily accessible, which are necessary for compiling certain packages. Choosing to install Python here means leveraging a secure system without the overhead of proprietary operating systems.
Checking Existing Installations
Before installing anything new, it is wise to check if Python is already present. Many system utilities rely on Python 3, so it might be available under a different configuration. Running a quick command reveals the version and helps determine if you need a fresh install or an upgrade.
Open the terminal application from the menu.
Type python3 --version and press Enter.
Observe the output, which will look similar to Python 3.10.12 .
Method 1: Using APT (Recommended for Stability)
The Advanced Package Tool (APT) is the default package manager for Linux Mint. Using the main repository ensures a stable installation that is well-integrated with the system’s update cycle. This method is recommended for most users who need the standard Python 3 release.
To install via APT, you first update the local package index to ensure you get the latest version available in the repositories. Then, you install the python3 package along with pip , the package installer for Python.
Step-by-Step Terminal Commands
Follow these sequential commands to update your system and install Python. The -y flag automatically confirms the installation prompts, allowing the process to run without manual intervention.
sudo apt update && sudo apt upgrade -y
sudo apt install python3 python3-pip -y
Method 2: Installing Specific Versions with Deadsnakes
When a project requires a specific Python version not available in the default repositories, the deadsnakes PPA becomes essential. This external repository maintains a vast collection of Python releases, including older and cutting-edge versions. It provides the flexibility that the standard APT repository cannot match.
Adding this PPA involves installing the software-properties-common package to manage sources and then adding the PPA key. Once added, you can install any version listed without disrupting the system’s default Python installation.
Adding the Repository and Installing
The following commands add the deadsnakes repository and install the desired version. Replace 3.11 with the specific version number you require for your development workflow.
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt update
sudo apt install python3.11
Verifying the Installation
After the installation completes, verification is a critical final step. This confirms that the correct interpreter is active and that the associated package manager, pip, is functional. A successful check ensures that your development environment is ready for coding.