Getting Python running on Linux Mint doesn't have to be complicated. If you're setting up a development environment, you can have the interpreter and package manager ready in minutes using the built-in APT package manager.
Most modern Linux Mint releases ship with Python or make it accessible via simple terminal commands. Let's walk through checking your current system state, installing the correct version, avoiding common package conflicts, and setting up isolated workspaces for your scripts.
Checking Existing Python Installations
Before you install anything, check if Python is already present on your system. Linux distributions often include Python for system tasks.
Open your terminal and run this command:
python3 --version
If a version number returns, Python is already installed. However, you might want a newer release or the associated package installer, pip. If you see a command not found error, or if you need a specific minor version that matches your project requirements, proceed with the installation steps below.
Installing Python via APT
The most reliable and maintainable method for installing Python on Linux Mint is through the official package repositories. This ensures your installation receives security updates alongside your operating system.
First, refresh your local package index so your system knows about the latest available versions:
sudo apt update
Next, install the core Python 3 package by running:
sudo apt install python3
To manage external libraries and packages effectively, you'll also want pip, the package installer for Python. Install it with:
sudo apt install python3-pip
Once the installation finishes, verify that everything works correctly by checking the package manager version:
pip3 --version
Setting Up Virtual Environments
Installing packages globally can break system tools or cause version conflicts between different projects. Creating an isolated virtual environment is standard practice for any Python developer.
First, install the virtual environment package corresponding to your Python version:
sudo apt install python3-venv
Create a dedicated folder for your project and navigate into it:
mkdir my_project
cd my_project
Generate the virtual environment inside your project folder:
python3 -m venv env
Activate the environment to route your terminal session through the isolated workspace:
source env/bin/activate
Your terminal prompt will change to show the active environment name in parentheses. Any packages you install using pip while this environment is active stay contained within this directory and won't affect other projects or your base operating system.
When you're finished working, deactivate the environment by simply typing:
deactivate
Common Installation Pitfalls and Fixes
Developers often run into specific snags when configuring Python on Debian-based distributions like Linux Mint. Here's how to handle them:
- Broken Pip Symlinks: If
pip3throws errors or points to an unexpected path, reinstall it cleanly usingsudo apt install --reinstall python3-pip. - Externally Managed Environments: Modern Linux distributions protect system Python packages by blocking global
pip installcommands. Always use virtual environments as shown above to bypass this restriction safely. - Outdated Package Lists: If APT fails to locate
python3-venv, ensure you ransudo apt updateand that your Mint repository mirrors are active in the Software Sources manager.
For more details on package management policies, consult the official Ubuntu Documentation regarding software maintenance and repositories.
Frequently Asked Questions
Can I run Python 2 and Python 3 simultaneously on Linux Mint?
Python 2 reached end-of-life years ago and is omitted from modern Linux repositories. You shouldn't install Python 2 unless you're maintaining legacy codebases, in which case containerization is safer.
How do I install a specific older version of Python?
You can add a trusted Personal Package Archive (PPA) like deadsnakes, though using the default repository version is strongly recommended for stability on desktop systems.
Where are virtual environment files stored?
They live entirely inside the directory you specified during creation, such as the env folder in your project directory. You can delete the folder entirely to remove the environment.
Do I need root privileges to run Python scripts?
Never run Python scripts or pip installs with sudo unless you are modifying system-wide configurations. Normal user permissions are sufficient for running interpreters and managing local project environments.