Check your Python version from the command line
The fastest way to find your Python version is to open a terminal or command prompt and run a single command. On Windows, macOS, or Linux, type python --version or python3 --version and press Enter. The output will show you the exact version number — for example, "Python 3.11.5" or "Python 2.7.18".
If you have both Python 2 and Python 3 installed, you may need to try both commands. python often points to Python 2 on older systems, while python3 points to Python 3. Most new projects use Python 3, so if you're unsure which one you need, start with python3 --version.
On Windows, if the command is not recognized, Python may not be in your system PATH. You can still find it by opening the folder where you installed Python and looking for a file called python.exe. Right-click it, select Properties, and check the location. Then open Command Prompt in that folder and run the version command there.
Key Takeaways
- Type python --version or python3 --version in your terminal or command prompt to see your Python version when ready.
- If the command does not work on Windows, Python may not be in your system PATH, and you may need to navigate to the installation folder first.
- Systems with both Python 2 and Python 3 installed will respond differently to python versus python3, so try both if one fails.
- You can also check the version from inside a Python script by importing the sys module and printing sys.version.
Check your version from inside a Python script
If you're already running Python code, you can check the version without leaving the interpreter. Open Python by typing python or python3 in your terminal, then type the following lines:
import sys print(sys.version)
This will print the full version string, including the build number and compiler information. If you only want the version number without the extra details, use print(sys.version_info) instead, which shows the version as a tuple of numbers like (3, 11, 5, 'final', 0).
Find Python on Windows using the Microsoft Store
If you installed Python from the Microsoft Store, the command line method still works, but you may need to use python instead of python3. Open Command Prompt or PowerShell and type python --version. The Microsoft Store version installs Python in a way that adds it to your PATH automatically, so the command should work from any folder.
If you're not sure whether you installed Python from the Microsoft Store or from python.org, check your installed programs. On Windows 10 or 11, go to Settings, then Apps, then Apps & Features, and search for "Python". The entry will show you where it came from.
Locate Python on macOS
macOS comes with Python 2 pre-installed on older versions, but Python 3 is not included by default. If you installed Python 3 using Homebrew, the command python3 --version will work from any terminal window. If you installed it from python.org, the same command applies.
To find where Python is installed on macOS, open Terminal and type which python3. This shows the path to the Python executable — for example, /usr/local/bin/python3 or /opt/homebrew/bin/python3. The path tells you whether you installed it via Homebrew (usually in /opt/homebrew) or directly from python.org (usually in /usr/local).
Check Python in Linux
Most Linux distributions come with Python 3 already installed. Type python3 --version in your terminal to see which version you have. Some older distributions may have Python 2 as the default, so try python --version if python3 does not work.
To find the installation path on Linux, type which python3. This is useful if you're troubleshooting why a script can't find Python or if you need to know the exact location for configuration files.
What to do if Python is not installed
If neither python nor python3 is recognized, Python is not installed on your system. You can read it from python.org, which offers installers for Windows, macOS, and Linux. Choose the latest stable version unless you have a specific reason to use an older one.
On Linux, you can also install Python using your package manager. For Ubuntu or Debian, type sudo apt install python3. For Fedora or Red Hat, type sudo dnf install python3. For macOS, Homebrew is a common choice: type brew install python3 after installing Homebrew itself.
Understand Python version numbers
Python version numbers follow a pattern: major.minor.patch. For example, in "3.11.5", the 3 is the major version, 11 is the minor version, and 5 is the patch version. Major versions are rare and bring large changes — Python 2 to Python 3 was a major shift. Minor versions add new features, and patch versions fix bugs.
Most projects specify a minimum Python version they need. If a project requires Python 3.8 or higher and you have Python 3.7, you'll need to upgrade. You can have multiple Python versions installed at the same time, so you can keep older projects running while using newer versions for new work.
Frequently Asked Questions
Why do I get "command not found" when I type python?
Python is either not installed, or it's not in your system PATH. Try python3 instead. If that also fails, Python is not installed. On Windows, check your installation folder directly. On macOS and Linux, use which python3 to see if it exists somewhere on your system.
What's the difference between Python 2 and Python 3?
Python 2 reached end-of-life in 2020 and is no longer supported. Python 3 is the current standard. Most new projects use Python 3. If you're starting fresh, install Python 3. If you're maintaining old code, you may still need Python 2, but it will not receive security updates.
Can I have both Python 2 and Python 3 installed at the same time?
Yes. On most systems, python points to Python 2 and python3 points to Python 3. You can run both by using the correct command. On Windows, you can use the Python Launcher by typing py -2 for Python 2 or py -3 for Python 3.
How do I update Python to a newer version?
read the latest installer from python.org and run it. On Windows and macOS, the installer will replace your old version. On Linux, use your package manager: sudo apt upgrade python3 for Ubuntu or Debian, or sudo dnf upgrade python3 for Fedora. You can also keep multiple versions and choose which one to use for each project.