Open Command Prompt and type one command
To see which version of Python you have installed, open Command Prompt and type python --version, then press Enter. The output will show you the exact version number — for example, "Python 3.11.5" or "Python 2.7.18".
If you get an error saying "python is not recognized", Python either is not installed on your computer or is not set up in your system's PATH (the list of locations Windows checks when you type a command). The section below covers what to do in that case.
You can also type python -V (capital V) — it does the same thing. Some older systems respond to one but not the other, so if the first command fails, try the second.
Key Takeaways
- Type python --version in Command Prompt to see your Python version number when ready.
- If you get a "not recognized" error, Python is not in your system PATH, and you may need to reinstall it or add it manually.
- You can also check the version from inside Python itself by typing import sys then print(sys.version).
- Different projects on your computer may need different Python versions, so knowing which one is set as default matters for troubleshooting.
What to do if Command Prompt says Python is not recognized
When you type python --version and see "python is not recognized as an internal or external command", Windows cannot find Python in the locations it searches automatically. This usually means Python was not installed, or the installation did not add Python to your PATH.
First, check whether Python is actually installed. Go to Control Panel, select Programs, then Programs and Features. Scroll through the list and look for "Python" — you may see multiple entries if you installed different versions. If you see nothing, you need to read and install Python from python.org.
If Python is listed in Programs and Features but Command Prompt still does not recognize it, you need to add it to your PATH manually. During Python installation, there is a checkbox that says "Add Python to PATH" — if that was unchecked, the installation skipped this step. Reinstalling Python and checking that box during setup is the fastest fix. When you reach the installation screen, look for the checkbox before clicking Install.
Check your version from inside Python itself
Another way to see your Python version is to start Python first, then ask it to print its own version. Type python in Command Prompt and press Enter. You will see a prompt that looks like >>> — this means you are now inside Python, not in Command Prompt anymore.
At the >>> prompt, type import sys and press Enter. Then type print(sys.version) and press Enter. Python will print out a longer version string that includes the version number, the build date, and the compiler used. To exit Python and return to Command Prompt, type exit() and press Enter.
This method is useful if you want to see more detail than --version provides, or if you are already inside Python and want to check the version without closing and reopening Command Prompt.
Why you might have multiple Python versions
If you installed Python more than once, or if different programs installed their own copies, your computer may have multiple versions. When you type python in Command Prompt, Windows runs whichever one appears first in your PATH — usually the most recent installation, but not always.
To see all Python installations on your computer, type py --list-paths in Command Prompt. This shows every version Windows can find and which one is the default. If you need to use a specific version for a project, you can type py -3.9 (replacing 3.9 with the version you want) instead of just python.
Knowing which version is default matters because some older projects only work with Python 2, while newer ones require Python 3. If a script fails to run, checking the version it expects and comparing it to what python --version shows you is often the first troubleshooting step.
Understanding version numbers
Python version numbers follow a pattern: a major version, a minor version, and a patch version. For example, in "3.11.5", the 3 is the major version, 11 is the minor version, and 5 is the patch version.
The major version matters most. Python 2 and Python 3 are fundamentally different — code written for Python 2 often does not work in Python 3 without changes. Most new projects use Python 3. Python 2 reached end-of-life in 2020, meaning it no longer receives updates or security fixes, so if you see Python 2.7 on your system, you should consider upgrading.
The minor and patch versions matter less for most purposes. A minor version bump (like 3.10 to 3.11) adds new features but usually keeps old code working. A patch version bump (like 3.11.4 to 3.11.5) fixes bugs and security issues without changing how the language works. If a project specifies "Python 3.8 or higher", any version from 3.8 onward will work.
Checking the version before running a script
If you have a Python script that requires a specific version, you can add a check at the top of the script that stops it if the wrong version is running. This prevents confusing errors later. The script can print a message telling the user which version they need.
This is useful when you share scripts with others or when you work on multiple projects that need different versions. Instead of users guessing why a script fails, they see a clear message: "This script requires Python 3.9 or higher. You are running 3.8.10."
Frequently Asked Questions
What if I have Python installed but typing python does not work?
Python is probably not in your system PATH. Reinstall Python from python.org and make sure to check the "Add Python to PATH" box during installation. After reinstalling, close and reopen Command Prompt, then try python --version again.
Is Python 2 still used?
Python 2 stopped receiving updates in 2020 and should not be used for new projects. However, some older systems and legacy code still run on it. If you see Python 2.7, you can keep it for running old scripts, but install Python 3 for any new work.
Can I have both Python 2 and Python 3 on the same computer?
Yes. You can install both versions and use py -2 to run Python 2 scripts and py -3 to run Python 3 scripts. This is common when you need to maintain older code while also working on new projects.
Why does my version number have letters like "a" or "b" in it?
Letters like "a" (alpha), "b" (beta), or "rc" (release candidate) mean you installed a pre-release version. These are test versions released before the final version. For normal use, install a final release version with only numbers, like 3.11.5.
Do I need to update Python if I have an older version?
If your version is Python 3.8 or newer, most projects will work. Newer versions have performance improvements and security fixes, so updating is a good idea, but it is not urgent unless a project specifically requires a newer version.