/
/

How to Check the Python Version on Your System

by Richelle Arevalo, IT Technical Writer
How to Check the Python Version on Your System blog banner image

Instant Summary

This NinjaOne blog post offers a comprehensive basic CMD commands list and deep dive into Windows commands with over 70 essential cmd commands for both beginners and advanced users. It explains practical command prompt commands for file management, directory navigation, network troubleshooting, disk operations, and automation with real examples to improve productivity. Whether you’re learning foundational cmd commands or mastering advanced Windows CLI tools, this guide helps you use the Command Prompt more effectively.

Key Points

  • Check the Python version on your system using the command line to quickly confirm which interpreter runs by default based on PATH configuration.
  • Use the Python interpreter or runtime checks to verify the exact Python version and build details that execute scripts and applications.
  • Identify all installed Python versions to resolve conflicts when multiple interpreters exist on the same system.
  • Check the Python version inside a virtual environment to confirm that the project runs on the correct isolated interpreter instead of the system default.
  • Validate Python version within scripts or applications to prevent automation failures in CI, CD, and scheduled workflows.

Python is widely used for automation, scripting, and application development. Many tools and scripts require a specific Python version to run correctly. If the wrong version is used, issues may arise. This is why checking the Python version on your system before running scripts or tools is important. It helps you avoid compatibility problems and keep your automation reliable.

This guide shows you several ways to check the Python version on your system, including methods from the command line, virtual environment, and scripts.

📌 Recommended deployment strategies:

Click to Choose a Method

💻

Best for Individual Users

💻💻💻

Best for Enterprises

Method 1: Check Python version using the command line
Method 2: Check Python version from the Python interpreter
Method 3: Identify all installed Python versions on the system
Method 4: Check Python version inside a virtual environment
Method 5: Check Python version in a script or application

Methods to check the Python version on your system

This guide walks you through five ways to check the Python version on your system. Before you start, make sure you meet the requirements below.

📌 General prerequisites: 

  • Access to the system command line or terminal
  • Python installed on the system
  • Appropriate permissions to run commands
  • Awareness of whether the system uses execution aliases or virtual environments

Method 1: Check Python version using the command line

The command line gives you the fastest way to confirm your Python version. In this method, you check the interpreter your system runs by default based on the current PATH configuration.

Steps:

  1. Open the command line.
    • Windows: Press Win + R to open the Run dialog, type cmd, and click Enter to open the Command Prompt.
    • MacOS: Press Command + Space to open Spotlight Search, type Terminal, and click Return.
    • Linux: Press Ctrl + Alt + T or open the applications menu and search Terminal, and open it.
  2. Run the following command:

python --version

  1. If the command doesn’t return Python 3, run:

python3 --version

  1. Review the output to identify the installed Python version. It should look like this:

Python 3.11.7

📌 Note: This method shows the Python version linked to your current system PATH. If you have multiple Python versions installed, your system runs the interpreter that appears first in the PATH order.

Method 2: Check Python version from the Python interpreter

Another reliable method is checking the Python version inside Python itself. This method runs the check from an active interpreter session and gives you a more detailed version information, including build and compiler data.

Steps:

  1. Open the command line.
    • Windows: Press Win + R to open the Run dialog, type cmd, and click Enter to open the Command Prompt.
    • MacOS: Press Command + Space to open Spotlight Search, type Terminal, and click Return.
    • Linux: Press Ctrl + Alt + T or open the applications menu and search Terminal, and open it.
  2. Start the Python interpreter by running:

python

or, if needed:

python3

  1. At the Python prompt (>>>), enter:

import sys
print(sys.version)

  1. Review the output to confirm the Python version and build details.
  2. Exit the interpreter:

exit()

💡You can also press Ctrl + D on macOS/Linux, or Ctrl + Z then Enter on Windows.

📌 Note: This method shows the version used by the active interpreter session. The result may differ from other installed Python versions on the system.

Method 3: Identify all installed Python versions on the system

If your system has multiple Python installations, this method helps you identify them. It lists every Python interpreter your system can access through the command line. Use this method when you’re resolving version conflicts or when you want to confirm which Python versions are available for your projects.

Steps:

  1. Open the command line.
    • Windows: Press Win + R to open the Run dialog, type cmd, and click Enter to open the Command Prompt.
    • MacOS: Press Command + Space to open Spotlight Search, type Terminal, and click Return.
    • Linux: Press Ctrl + Alt + T or open the applications menu and search Terminal, and open it.
  2. On Windows, run:

where python

This command lists all paths where python.exe exists.

  1. On macOS or Linux, run:

which -a python
which -a python3

This command shows all paths where Python binaries are found.

  1. Review the list of Python executables and their file paths.

📌 Note: This method lists Python executables resolved through your system PATH. It doesn’t show Python installations that aren’t accessible from the command line.

Method 4: Check Python version inside a virtual environment

Virtual environments isolate dependencies and Python versions per project. When you use a virtual environment, you must check the Python version after activation. This confirms that your project runs on the intended interpreter and not the system default.

Steps:

  1. Activate the virtual environment.
    • Windows (Command Prompt):

.\.venv\Scripts\activate

    • Windows (PowerShell):

.\.venv\Scripts\Activate.ps1

    • macOS/Linux:

source .venv/bin/activate

  1. Once the environment is active, check the Python version by running:

python --version

  1. Review the output to confirm the Python version assigned to the virtual environment.
  2. Deactivate the environment when you’re done:

deactivate

Method 5: Check Python version within a script or application

Sometimes, you need to confirm the Python version while a script or application is running. This approach works well for automated workflows, CI/CD pipelines, and scripts that rely on specific Python features. You can use it to verify the runtime interpreter before your code runs critical logic.

Steps:

  1. Add the following lines to your Python script:

import sys
print(sys.version_info)

  1. Run the script using your intended execution method (command line, scheduler, pipeline, or an application runtime).
  2. Review the output to confirm the Python version used during execution.

Additional considerations

Keep the following points in mind to avoid confusion and get accurate results when you check Python versions.

Windows execution aliases

On Windows, execution aliases can redirect the python command to the Microsoft Store version instead of your installed interpreter. This can lead to unexpected results when you check the Python version.

You can manage execution aliases through Settings > Apps > App execution aliases, or use the Python launcher (py –version) to confirm which interpreter runs.

Python 2 and Python 3 coexistence

Some systems have both Python 2 and Python 3 installed at the same time. In these cases, the python command may point to Python 2, while python3 points to Python 3.

Virtual environments

Virtual environments isolate Python versions per project. The Python version inside a virtual environment can differ from your global installation.

💡 Activate the environment before checking the Python version to avoid misleading results.

PATH order

Your system PATH controls which Python executable runs by default. If multiple versions are installed, the first entry in PATH takes priority.

Tools requiring python3

Some tools explicitly call python3, even when python exists. This avoids ambiguity and ensures access to Python 3 language features.

Troubleshooting

If you run into issues while checking Python versions, review the common problems below and follow the suggested actions to resolve them.

Python command not found

Python may not be installed, or your system may not be able to locate it. Install Python from python.org or through your package manager. After installation, verify that the installation directory is added to your system PATH.

Wrong version reported

If the reported version isn’t what you expect, Windows execution aliases or PATH order may be redirecting the python command. Check execution alias settings to confirm which interpreter appears first in PATH.

Script fails unexpectedly

When a script fails without a clear cause, the active Python version may not meet its requirements. Make sure the script runs with the intended interpreter and that the required Python version is active at runtime.

Virtual environment mismatch

If version checks return the system Python instead of the project version, the virtual environment may not be active. Activate the environment before running checks or scripts and confirm that the command prompt reflects the active environment.

Multiple versions causing confusion

Standardize Python versions per project or environment. Use python3 for modern projects and consider tools like pyenv on macOS/Linux, or the Python launcher py on Windows.

Using the right methods to check the Python version accurately

Checking the Python version on your system is a simple step, but you should not overlook it. It plays a direct role in keeping automation, scripts, and development workflows stable. You can check the Python version in several ways, such as through the command line, the Python interpreter, or active environments.

Being able to quickly confirm which Python version is installed and running reduces errors and helps you keep systems consistent across users and devices.

Related topics:

FAQs

On some systems, python may point to Python 2 or a Microsoft Store alias. The python3 command explicitly runs Python 3 and avoids confusion when multiple versions exist.

Yes. Many systems have multiple versions installed to support older software or different projects. Which version runs depends on PATH order or the active environment.

You can check the runtime version from inside the script using sys.version or sys.version_info.

No. You can check the Python version using standard user access. None of the methods in this guide requires administrator permissions.

Many tools depend on specific language features or libraries available only in certain versions. Using the wrong version can break scripts or workflows.

You might also like

Ready to simplify the hardest parts of IT?