How To Install Python On Linux Mint – Mint Software Manager Installation

Linux Mint’s Software Manager simplifies Python installation with a graphical interface, but you might need more control over versions. If you’re wondering how to install python on linux mint, this guide covers every method from the GUI to the terminal, ensuring you get the right Python setup for your projects.

Python is a versatile language used for scripting, web development, data science, and automation. Linux Mint, being a user-friendly Ubuntu-based distribution, makes Python installation straightforward. However, you may encounter situations where the default version isn’t what you need, or you want multiple versions side by side.

This article walks you through five reliable ways to install Python on Linux Mint. We’ll cover the Software Manager, APT package manager, deadsnakes PPA, compiling from source, and using pyenv for version management. Each method has its strengths, and I’ll help you choose the best one for your workflow.

How To Install Python On Linux Mint

Before diving into installation, check what Python version is already on your system. Linux Mint typically comes with Python 3 pre-installed, but it might be an older release. Open a terminal by pressing Ctrl+Alt+T and type:

python3 --version

If you see output like Python 3.10.12, you already have Python installed. But if you need a newer version for a specific project, follow the methods below.

Method 1: Using The Software Manager

The easiest way for beginners is the Software Manager. It’s graphical and requires no terminal commands.

  1. Click the Mint menu (bottom-left corner) and select “Software Manager”.
  2. Search for “python3” in the search bar.
  3. You’ll see multiple packages like “python3”, “python3-pip”, and “python3-venv”.
  4. Click the one you want and hit “Install”.
  5. Enter your password when prompted.

This method installs the default Python version from the official Mint repositories. It’s safe and easy, but you won’t get the absolute latest Python release. The Software Manager is perfect if you just need Python for basic tasks and don’t care about bleeding-edge features.

Method 2: Installing Via APT In The Terminal

APT is the command-line package manager for Debian-based systems like Linux Mint. It gives you more control and is faster than the graphical interface.

First, update your package list to ensure you have the latest information:

sudo apt update

Then install Python 3 with:

sudo apt install python3

If you also want pip (Python’s package installer), add it:

sudo apt install python3-pip

For virtual environments, install the venv module:

sudo apt install python3-venv

That’s it. You now have Python 3 from the official Mint repos. The version will be the same as what you’d get from the Software Manager. This method is reliable and integrates well with system updates.

Method 3: Adding The Deadsnakes PPA For Newer Versions

If you need a specific Python version not available in the default repositories, the deadsnakes PPA is your friend. It provides multiple Python releases for Ubuntu-based distributions like Mint.

Add the PPA to your system:

sudo add-apt-repository ppa:deadsnakes/ppa

Press Enter when prompted to confirm. Then update your package list:

sudo apt update

Now you can install any Python version available in the PPA. For example, to install Python 3.12:

sudo apt install python3.12

You can also install the corresponding pip and venv:

sudo apt install python3.12-pip python3.12-venv

To use this version, type python3.12 instead of python3. The deadsnakes PPA is maintained by the Python community and is generally safe, but always verify the source if you’re concerned about security.

Method 4: Compiling Python From Source

For maximum control, compile Python from source. This method lets you customize build options and install the absolute latest version. It’s more complex and takes longer, but it’s useful for developers who need specific features.

First, install the build dependencies:

sudo apt update
sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev

Download the Python source code from the official website. Replace the version number with the one you want:

wget https://www.python.org/ftp/python/3.12.0/Python-3.12.0.tgz

Extract the archive:

tar -xf Python-3.12.0.tgz

Navigate into the directory:

cd Python-3.12.0

Configure the build with optimizations:

./configure --enable-optimizations

Compile using multiple cores to speed things up. The -j flag specifies the number of cores; adjust based on your CPU:

make -j 4

Install the compiled Python:

sudo make altinstall

Using altinstall instead of install prevents overwriting the default python3 binary. Your new Python will be available as python3.12. This method is powerful but time-consuming—expect 10-20 minutes for compilation.

Method 5: Using Pyenv For Version Management

Pyenv is a tool that lets you install and switch between multiple Python versions effortlessly. It’s ideal if you work on different projects requiring different Python releases.

First, install pyenv dependencies:

sudo apt update
sudo apt install make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev

Install pyenv using the automatic installer:

curl https://pyenv.run | bash

After installation, add pyenv to your shell configuration. For Bash, add these lines to ~/.bashrc:

export PYENV_ROOT="$HOME/.pyenv"
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

Restart your shell or run source ~/.bashrc to apply changes.

Now you can list available Python versions:

pyenv install --list

Install a specific version, for example Python 3.11.5:

pyenv install 3.11.5

Set it as the global default:

pyenv global 3.11.5

Or set it locally for a specific project directory:

cd my_project
pyenv local 3.11.5

Pyenv keeps your system Python untouched while giving you full control over versions. It’s the most flexible method for developers.

Setting Up Python Development Tools

Once Python is installed, you’ll want some essential tools. Pip is the package manager for installing libraries. If you installed Python via APT or deadsnakes, pip should be included. Verify with:

pip3 --version

Virtual environments keep project dependencies isolated. Create one with:

python3 -m venv myenv

Activate it:

source myenv/bin/activate

When activated, your terminal prompt changes to show the environment name. Install packages inside it without affecting your global Python.

For code editing, consider Visual Studio Code, PyCharm, or even a simple text editor like Geany. Linux Mint’s default text editor works for small scripts.

Verifying Your Installation

After installation, confirm everything works. Test Python by running a simple script:

python3 -c "print('Hello, Linux Mint!')"

You should see the output. Check the version again:

python3 --version

If you installed multiple versions via pyenv, use pyenv versions to list them and pyenv which python to see the active one.

Troubleshooting Common Issues

Sometimes things go wrong. Here are frequent problems and fixes:

  • Command not found: Ensure Python is in your PATH. For pyenv, check your shell configuration.
  • Permission denied: Use sudo for system-wide installations, but avoid it for pip packages—use virtual environments instead.
  • SSL errors: When compiling from source, missing SSL libraries cause this. Install libssl-dev and reconfigure.
  • Pyenv not switching versions: Make sure the eval "$(pyenv init -)" line is in your shell config and you’ve restarted the shell.
  • Deadnsakes PPA not found: Your Mint version might not be supported. Check the PPA’s compatibility list.

Choosing The Right Method For You

Your choice depends on your needs. If you’re a beginner or just want Python for casual use, the Software Manager or APT method is fine. They’re simple and maintain system stability.

If you need a specific newer version for a project, the deadsnakes PPA is a good middle ground. It’s easy but gives you access to recent releases.

Compiling from source is overkill for most users. Only do this if you need custom build options or the very latest version not yet in any repository.

Pyenv is the best choice for developers working on multiple projects. It’s a bit more setup upfront but saves headaches later when you need to switch between Python 3.10 and 3.12.

Keeping Python Updated

If you used APT or the Software Manager, updates come through the regular system update process. Run:

sudo apt update && sudo apt upgrade

For pyenv, update the tool itself:

pyenv update

Then install newer Python versions as they become available. For source-compiled Python, you’ll need to repeat the compilation process for new releases.

Uninstalling Python Versions

If you need to remove a Python installation, the method depends on how you installed it.

For APT-installed Python:

sudo apt remove python3.12

For deadsnakes PPA:

sudo apt remove python3.12
sudo add-apt-repository --remove ppa:deadsnakes/ppa

For pyenv:

pyenv uninstall 3.11.5

For source-compiled Python, delete the installation directory (usually /usr/local/bin/python3.12 and related files). Be careful not to remove the system Python, as Mint depends on it.

Final Thoughts On Python Installation

Installing Python on Linux Mint is straightforward once you understand the options. The key is matching the method to your skill level and project requirements. Start with the simplest approach and graduate to more advanced methods as needed.

Remember to always use virtual environments for project isolation. This prevents dependency conflicts and keeps your system clean. Python’s ecosystem is vast, and having a solid installation foundation makes everything else easier.

Whether you’re writing automation scripts, building web apps, or diving into data science, Python on Linux Mint is a powerful combination. Take a few minutes to set it up properly, and you’ll save hours of troubleshooting later.

Frequently Asked Questions

Does Linux Mint come with Python pre-installed?

Yes, Linux Mint includes Python 3 by default. You can check the version by running python3 --version in the terminal. However, it might not be the latest release.

Can I install multiple Python versions on Linux Mint?

Absolutely. Using pyenv is the best way to manage multiple versions. You can also install different versions via the deadsnakes PPA or compile them manually. Each version gets its own binary name like python3.10 or python3.12.

What is the difference between python and python3 on Linux Mint?

On Linux Mint, python usually points to Python 2 (if installed), while python3 points to Python 3. Since Python 2 is deprecated, always use python3 or a specific version like python3.12 for new projects.

How do I install pip for Python on Linux Mint?

If you installed Python via APT, run sudo apt install python3-pip. For pyenv or deadsnakes installations, pip is usually included. Verify with pip3 --version. If missing, install it with sudo apt install python3-pip or use python3 -m ensurepip --upgrade.

Why should I use a virtual environment?

Virtual environments isolate project dependencies, preventing conflicts between different projects. For example, Project A might need Django 3.2 while Project B needs Django 4.0. Virtual environments let you keep both without issues. Always use them for serious development.