News & Updates

Install Python on Linux Mint: Easy Step-by-Step Guide

By Ava Sinclair 27 Views
install python linux mint
Install Python on Linux Mint: Easy Step-by-Step Guide

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 best practices for ensuring your environment is robust and ready for real-world work.

Verify the System and Package Manager

Before installing Python, it is helpful to confirm the Linux Mint version and ensure the local package index is current. Open the terminal and run the commands to check the OS build and refresh the repository cache.

lsb_release -a

sudo apt update

These steps confirm you are working on a supported platform and that you receive the latest available version from the official repositories.

Install Python from the Official Repository

The simplest method for most users is to install Python directly from the Linux Mint repository using APT. This approach handles dependencies automatically and integrates with the system package manager.

Install Python 3 and pip

To install the Python 3 interpreter along with the pip package manager, run the following command in the terminal.

sudo apt install python3 python3-pip Install Python 2 (if required) Although Python 2 is end-of-life, some legacy scripts may still require it. It can be installed from the repository if necessary, though it is generally recommended to migrate to Python 3 for security and compatibility.

Install Python 2 (if required)

Confirm the Installation

After the installation completes, verifying the versions of Python and pip ensures the process was successful and that the correct paths are configured.

python3 --version outputs the installed Python 3 release.

pip3 --version confirms the package manager is linked and ready.

Seeing the version numbers indicates that the executables are available system-wide.

Install Python via the Official Installer

For users who need the latest stable release beyond what the distribution provides, installing directly from python.org offers greater control over the version. This method is common in development environments where specific features or performance improvements are required.

Download the Linux x86-64 executable installer from the official Python website.

Open a terminal, navigate to the Downloads folder, and make the file executable with chmod +x ~/Downloads/python*.sh .

Run the installer with sudo ~/Downloads/python*.sh and follow the prompts.

Using the official installer places the new Python build into /usr/local , keeping it separate from the system-managed packages.

Manage Multiple Versions with Deadsnakes

When development requires testing against different Python releases, the Deadsnakes PPA provides a convenient way to install multiple versions side by side. This is particularly useful for maintaining compatibility across projects.

To add the repository and install a specific interpreter, use the following commands in the terminal.

sudo add-apt-repository ppa:deadsnakes/ppa

sudo apt update

sudo apt install python3.x (replace x with the desired minor version)

This approach gives flexibility without interfering with the default system Python.

Isolating project dependencies prevents version conflicts and keeps the global Python installation clean. Linux Mint users can leverage the venv module included with Python to create these sandboxed environments.

A

Written by Ava Sinclair

Ava Sinclair is a Senior Editor covering culture, travel, and premium experiences. She focuses on clear reporting and practical takeaways.