Last modified: Aug 22, 2026
How to Find Python Version (Easy Steps)
Knowing your Python version is crucial for compatibility. Many libraries and frameworks require specific Python releases. This guide shows you the fastest ways to check it on any operating system.
You might need this for debugging, setting up environments, or installing packages. The process is simple and takes less than a minute. Let's dive into the most reliable methods.
Check Python Version in the Terminal
The primary method is using the command line. This works universally across Windows, macOS, and Linux. Open your terminal or command prompt first.
Then, type one of the following commands and press Enter. The --version flag is the most common and widely supported option.
# Check the installed Python version
python --versionOn some systems, especially Linux and macOS, Python 3 is the default. If the above command fails, try using python3 explicitly. This is a common pitfall for beginners.
# Alternative command for Python 3
python3 --versionHere is what the output typically looks like. The exact numbers will vary based on your installation.
# Example output
Python 3.11.5This output tells you the major version (3), minor version (11), and micro version (5). This information is essential when reading documentation.
Using the -V Flag
Another short flag works identically to --version. The uppercase -V is a quick shorthand. It is just as effective and widely used by developers.
# Short flag for version
python -VBoth -V and --version produce the same output. Choose the one you find easier to type. Consistency is key for your workflow.
Check Version Inside a Python Script
Sometimes you need to verify the version from within a script. This is useful for runtime checks. You can use the sys module to fetch this information programmatically.
The sys.version attribute provides a detailed string. It includes the version number and additional build information. This is very helpful for logging.
# Import the sys module
import sys
# Print the full version string
print(sys.version)Here is the output you might see. Notice it includes the date and compiler details, not just the numbers.
# Example output
3.11.5 (main, Aug 24 2023, 11:32:23) [GCC 12.2.0] on linuxFor a cleaner output, you can use sys.version_info. This returns a tuple of numbers. It is perfect for conditional logic in your code.
# Import the sys module
import sys
# Access the version info tuple
print(sys.version_info)This prints a structured tuple. You can easily compare these values to check for minimum requirements.
# Example output
sys.version_info(major=3, minor=11, micro=5, releaselevel='final', serial=0)You can also access individual parts. For example, sys.version_info.major gives you just the major version number. This is a clean way to handle specific checks.
Check Version in Python Interactive Shell
You can also find the version while inside the Python interpreter. Start the interactive shell by typing python in your terminal. The version is displayed right at the prompt.
# Start the Python interpreter
pythonThe shell banner shows the version at the top. This is the first thing you see, making it effortless to spot.
# Example output
Python 3.11.5 (main, Aug 24 2023, 11:32:23) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>Once inside the shell, you can also use the platform module. This is another reliable method for a quick check. Type this directly at the >>> prompt.
# Using the platform module
import platform
print(platform.python_version())This prints a simple string like "3.11.5". It is a great alternative if you prefer the platform module over sys.
What if the Command is Not Found?
If you see a "command not found" error, Python might not be installed. Or it is not in your system's PATH. First, try python3 before assuming it's missing.
On Windows, you might need to use the full path. Sometimes the Python executable is not added to PATH during installation. Check your installation folder.
You can also use where python on Windows or which python on macOS/Linux. This locates the executable. This helps you understand your environment better.
# Find the Python executable path (macOS/Linux)
which python3If Python is truly missing, download it from the official website. Ensure you check the "Add to PATH" option during installation on Windows. This prevents many future issues.
Using Python Launcher for Windows
Windows users have a special tool called the Python Launcher. The command is py. This is very useful for managing multiple versions.
You can use it to check the default version. It also allows you to specify a version. This is a powerful feature for testing compatibility.
# Check the default Python version via launcher
py --versionYou can also list all installed versions. The launcher provides a simple interface for this. It is a must-know for Windows developers.
# List all installed Python versions
py --listThis command shows a list of available Python installations. It makes switching between versions for different projects very straightforward.
Conclusion
Finding your Python version is a fundamental skill. Whether you use python --version in the terminal or sys.version in a script, the process is quick. Understanding these commands helps you avoid compatibility headaches.
Remember to try python3 if python fails. For Windows, the py launcher is your best friend. Keep this guide handy for your next coding session.