Programming & Web Development · Guide
How to check your Python version and update it
One command tells you the version. The complications start when your machine has three Pythons installed, which is more common than you would think. Here is how to sort it out.
The Nextversity teamProgramming & Web Development schoolUpdated August 10, 20265 min read

On this page
The short answer
Open a terminal and run one of these:
- Windows:
python --versionorpy --version - macOS and Linux:
python3 --version
You get something like Python 3.12.4. First number is the major version (always 3 now), second is the feature release, third is the patch.
Inside a script or the interactive prompt, this works everywhere:
import sys
print(sys.version)
Why your machine has more than one Python
This is the part that confuses people, and it explains most version weirdness.
- macOS and many Linux distributions ship their own Python for system tools. It is often older, and it is not meant for your projects.
- The python.org installer adds another one.
- Homebrew, Anaconda, the Windows Store and version managers each add more.
So python and python3 can be different programs, and the one that runs depends on your PATH. To see which one is actually running:
- macOS and Linux:
which python3 - Windows:
where python
That prints the path to the executable, which usually explains everything.
Reading the version number
3.12.4 means:
- 3 is the major version. Python 2 reached end of life and should not be used for anything new.
- 12 is the feature release. New syntax and library changes land here, and this is the number that matters when a package says it needs 3.10 or later.
- 4 is the patch, which is bug fixes and security only.
The current supported releases are listed on the python.org downloads page, and the official documentation always matches the version you select at the top of the page.
How to update
Windows. Download the latest installer from python.org and run it. Tick "Add Python to PATH". Use the py launcher (py -3.12 script.py) if you keep several versions around, since it is designed for exactly this.
macOS. The python.org installer works. Homebrew (brew install python) also works if you already use it. Do not remove the system Python.
Linux. Your package manager will have a version, though often not the newest. For a current release without touching system Python, use a version manager.
Any platform, if you juggle projects. A version manager such as pyenv lets each project use a different Python, which is the tidiest answer once you have more than one thing on the go.
The correct number of Pythons on a computer is one more than you thought you had installed. Checking which one is running takes four seconds and saves an afternoon.
Virtual environments matter more than the version
Once you install packages, use a virtual environment per project. It keeps each project's packages separate, so upgrading something for one does not break another.
python3 -m venv .venv
source .venv/bin/activate # macOS and Linux
.venv\Scripts\activate # Windows
Your prompt changes to show the environment is active. Install packages with pip now and they live in this folder only. This one habit prevents most "it worked yesterday" problems, and it is worth adopting on day one rather than after your first collision.
When the version is not your problem
If a tutorial does not work, check the version first, then check for these more likely causes:
- The tutorial is for Python 2. Look for
print "hello"without brackets. - You are running the wrong file, or from the wrong folder.
- A package is missing, which is a pip problem rather than a version problem.
- You are in the wrong virtual environment, or forgot to activate it.
Where to go next
If you are setting up because you are starting out, the first script guide takes it from here, and the learning roadmap covers the order after that.
For the full path, the Python certificate starts at the beginning and the advanced certificate covers structure and larger projects. One subscription opens the whole Programming & Web Development school.
Check the version, know which Python is running, use a virtual environment. Setup done, on with the actual programming.
Questions people ask
How do I check my Python version?
Run python --version in a terminal. On macOS and Linux use python3 --version, and on Windows py --version also works. Inside a script, import sys and print sys.version.
Why do python and python3 show different versions?
Because they are different installations. Systems often ship their own Python, and installers add another. The name python may point at an older one, which is why python3 is the safer command on macOS and Linux.
How do I update Python?
On Windows and macOS, download the current installer from python.org and run it. On Linux, use your package manager or a version manager. Version managers like pyenv are the tidiest option if you juggle projects.
Should I uninstall my old Python version?
On macOS and Linux, no. The system may depend on the Python it shipped with, and removing it can break things. Leave it alone and use a version manager or virtual environments instead.
Which Python version should I use?
The current stable Python 3 release, unless a specific project pins an older one. Python 2 is long past end of life, and any tutorial using it should be ignored.