Getting Python set up on Linux Mint is a straightforward process that provides a stable and user-friendly foundation for development. This guide walks through the native package manager, the official installer, and common verification steps to ensure a reliable environment. The goal is to help both new and experienced users establish a working Python installation without unnecessary complexity.
Checking the Default Python Installation
Linux Mint typically ships with Python pre-installed to support system maintenance tools. Before installing a new version, it is good practice to verify what is already available. Opening a terminal and checking the version prevents redundant actions and clarifies which interpreter is being used for system tasks.
Verifying System Python
Run the following commands in the terminal to inspect the current Python setup. These commands report the version of Python 2 and Python 3 that are available by default.
Command Description
Command
Description
python --version Checks Python 2 version (if still present)
python --version
Checks Python 2 version (if still present)
python3 --version Checks Python 3 version
python3 --version
Checks Python 3 version
Installing Python via APT Package Manager
The Advanced Package Tool (APT) is the standard method for installing software on Linux Mint. It handles dependencies automatically and integrates with the system update mechanism. Using the repository ensures that security patches are delivered through the standard update process.
Updating and Installing Python 3
First, refresh the local package index to ensure access to the latest available versions. Then, install the Python 3 interpreter and the associated development headers required for compiling modules.
sudo apt update sudo apt install python3 python3-dev Installing Pip and Virtual Environment Tools The Pip package manager is essential for installing Python libraries from the Python Package Index (PyPI). Additionally, creating isolated virtual environments prevents dependency conflicts between projects. These tools are often separate from the base interpreter package.
Installing Pip and Virtual Environment Tools
Setting Up Pip and Venv
Install Pip for Python 3 and the built-in module for creating virtual environments. This allows for clean project-specific dependencies and easier management of development workflows.
sudo apt install python3-pip python3-venv Verify the installation by checking the Pip version to confirm it is ready for use.
pip3 --version Installing Python from the Official Source When the repository version is outdated, compiling from source provides access to the latest features and performance improvements. This method is useful for specific development needs or testing new language versions. It requires additional build tools to compile the interpreter.
Installing Python from the Official Source
Preparing the System for Source Build
Install the necessary build essentials and libraries required to compile Python. This includes compilers like GCC and development headers for various system libraries.
sudo apt install build-essential libssl-dev libbz2-dev libreadline-dev libsqlite3-dev wget llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python3-openssl git Downloading and Compiling Python Retrieve the latest source code from the official Python website using a secure download. Extract the archive and configure the build environment to optimize for the local system architecture. The compilation process can take several minutes depending on the hardware.