Python ships with most modern operating systems, but the build you started with rarely stays current. Newer releases bring fixes, performance gains, and library compatibility older versions cannot match. The steps to update Python differ across systems, since each one leans on its own package handler or installer. Here is how to update Python on Linux, Windows, and Mac without breaking what already works.

How to Update Python on Linux

Linux splits into two main families, and each leans on its own package tool. Confirm your distribution first — the check Linux version guide covers the quickest way to read both your distro and kernel build.

Debian and Ubuntu

On Debian-based machines, refresh the package list first so the system knows what is available:

sudo apt update

Then pull in the build you want with apt. Name the exact release, such as 3.14:

sudo apt install python3.14

Swap python3.14 for whichever number fits your case. If apt itself throws an error, the apt-get command not found guide covers the common fixes. Confirm the result:

python3 --version

Red Hat and Fedora

On RHEL, CentOS, and Fedora, dnf does the work. Refresh metadata first:

sudo dnf update

Then ask dnf for the release you want:

sudo dnf install python3.14

Verify after install completes:

python3 --version
Linux familyRefresh commandInstall command
Debian / Ubuntusudo apt updatesudo apt install python3.14
Red Hat / Fedorasudo dnf updatesudo dnf install python3.14

When Python Is Not Installed

If Python is missing from the system, set it up first with the command that matches your distribution:

DistributionInstall Python
Ubuntusudo apt install python3
Fedorasudo dnf install python3
CentOSsudo yum install python3

A fresh install already includes the newest stable build. To push it higher by hand later, run:

sudo apt upgrade python3

If you need to lock or downgrade to a particular build, the apt install specific version walkthrough lays out the syntax.

How to Update Python on Windows

Before changing anything on Windows, check what is already on the machine. Open Command Prompt as administrator and type:

python --version

If the output is blank or unclear, Python is not set up properly. Windows will not refresh Python through the terminal the way Linux does. Go to python.org, grab the latest installer, and run it. Reopen Command Prompt to read the new version once installation finishes.

Once Python is in place, the Python man page lays out every flag the binary supports.

How to Update Python on Mac

The Mac steps look much like Windows. Open Terminal and read your current build first:

python3 --version

Homebrew Route

If Homebrew is on your system, two commands handle it:

brew update
brew upgrade python

Brew pulls the newest stable release and replaces the older binary in place.

Manual Installer Route

Visit the Python downloads page, grab the latest .pkg file, and run it. The installer keeps prior versions intact, so multiple Pythons can sit on the same Mac. Confirm with:

python3 --version

Checking Your Python Version After Updating

The version flag works the same across every system. On Mac and Linux, python3 –version returns the installed build. On Windows, python –version does the same. If you manage RPM systems often, the check RHEL version guide pairs well with tracking Python builds across servers.

Curious which handler runs the smoothest update on average? The APT vs YUM/DNF usage data covers the numbers, and the Linux command line guide is a useful primer if you are new to terminal work.

FAQs

Will updating Python break my existing scripts?

Most minor updates stay backward compatible. Major version jumps, like 3.11 to 3.13, can break scripts that rely on removed modules or deprecated syntax. Test in a virtual environment before upgrading on production machines.

Does updating Python also update pip?

A fresh Python install ships with a recent pip, but not always the newest. Run python -m pip install –upgrade pip right after updating Python to pull the latest pip release on top of the new interpreter.

Can I keep multiple Python versions on the same system?

Yes. Linux and Mac handle this through versioned binaries like python3.11 and python3.13 sitting side by side. Windows uses the py launcher, which lets you call any installed build using py -3.12 syntax.

Why does Mac still show Python 2 after I install Python 3?

Older macOS keeps Python 2 for legacy compatibility. Use python3 explicitly instead of python. Do not delete the system Python on older builds, since some macOS internal scripts still depend on it for routine tasks.

Is Homebrew safer than the .pkg installer for updating Python on Mac?

Both work reliably. Homebrew makes future updates a single brew upgrade python command. The .pkg installer places files in /Library/Frameworks and follows Apple’s expected install structure, which suits users who want a closer-to-default setup.

Willie has over 15 years of experience in Linux system administration and DevOps. After managing infrastructure for startups and enterprises alike, he founded Command Linux to share the practical knowledge he wished he had when starting out. He oversees content strategy and contributes guides on server management, automation, and security.