Python is a popular programming language used for web development, data analysis, automation, and artificial intelligence. Knowing your installed Python version helps you run code, install packages, and fix errors. Different projects may need different versions, so checking yours is a useful first step.
If you want to learn How to Check Python Version, the quickest method is to open your terminal and run python –version on Windows or python3 –version on macOS and Linux. You can also check the version inside Python code or your editor. This guide explains each method, common errors, and ways to manage multiple Python versions.
How to Check Python Version

You can check your Python version with a short command. The exact command depends on your operating system and how Python was installed.
For example, a result like Python 3.12.4 means you have Python version 3.12.4 available through that command. The first number is the major version, the second is the minor version, and the third is the patch version.
Use the method below that matches your device.
1. How to Check Python Version in Windows
Windows offers several ways to check Python, including Command Prompt, PowerShell, and the Python launcher.
Check Python version in CMD
Follow these steps:
- Press Windows + R on your keyboard.
- Type cmd and press Enter.
- Enter this command:
python –version
- Press Enter to view the result.
You may see output like this:
Python 3.12.4
This confirms that the python command can find a Python installation.
If the command does not work, try:
python -V
Both commands display the version when the python command is set up correctly.
Use the Python launcher
Windows installations may include a launcher named py. Try this command:
py –version
To check a specific installed version, run:
py -3.12 –version
This checks Python 3.12 if that version is installed and registered with the launcher.
2. How to Check Python Version on Mac
On macOS, Python 3 is commonly accessed through the python3 command.
- Open Spotlight Search by pressing Command + Space.
- Type Terminal and open it.
- Run this command:
python3 –version
- Press Return to see the installed version.
For example, the terminal may display Python 3.11.8.
If you see a command-not-found message, Python 3 may not be installed or available through your current PATH. Check your installation before trying another command. Avoid assuming that python and python3 point to the same installation. Always check the command your project uses.
3. How to Check Python Version on Linux
Most Linux distributions provide a terminal for running Python commands. The command python3 is commonly used to access Python 3.
Open your terminal and run:
python3 –version
To check whether the shorter command also works, try:
python –version
The results may differ because these commands can point to separate installations. Some systems do not define the python command by default.
If you need to find the executable path, run:
which python3
This shows the path used by your shell to find python3. On systems that use other shells or tools, the exact command may vary. For Linux, use your distribution’s package manager when you need to install or update Python. Avoid replacing the system Python without checking which system tools depend on it.
4. How to Check Python Version Using Python Code
You can check the version from inside a Python program. This method is useful when you want to confirm which version runs your script.
Use the sys module:
import sysprint(sys.version)
This prints the Python version and other build details.
To get the version numbers separately, use:
import sysprint(sys.version_info)
The output may look like this:
sys.version_info(major=3, minor=12, micro=4, releaselevel=’final’, serial=0)
Here, major is the main version number, minor is the next number, and micro is the patch number.
For a simple version number, use:
import sysprint(f”{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}”)
This is useful when you need to check the version from a script or troubleshoot a project.
5. How to Check Python Version in VS Code
Visual Studio Code can use different Python installations. The version in your terminal may not match the interpreter selected for your project.
To check the selected interpreter:
- Open your project in VS Code.
- Open the Command Palette using Ctrl + Shift + P on Windows or Linux. On Mac, use Command + Shift + P.
- Search for Python: Select Interpreter.
- Review the available Python environments and their versions.
- Select the interpreter your project needs.
You can also open the VS Code terminal and run:
python –version
If needed, try python3 –version. To confirm the interpreter used by a running script, run print(sys.executable) inside that script.
6. How to Check Python Version in PyCharm
PyCharm lets you choose an interpreter for each project. To check it:
- Open your project in PyCharm.
- Open Settings on Windows or Linux, or Preferences on macOS.
- Find the project’s Python interpreter settings.
- Review the selected interpreter and its version.
You can also run this code in the PyCharm console:
import sysprint(sys.version)
If the version differs from your system terminal, check the project’s interpreter settings. Your project may use a virtual environment with its own Python installation.
How to Check If Python Is Installed
Run the command for your operating system:
- Windows: python –version or py –version
- Mac: python3 –version
- Linux: python3 –version
If a version number appears, the command can access Python. If you see an error, Python may be missing or the command may not be configured correctly.
Download Python from the official Python website if you need to install it. Follow the instructions for your operating system, then reopen your terminal and try again.
Remember that a command failing does not always mean Python is absent. It may be installed but missing from your PATH.
What to Do If the Python Version Command Does Not Work
If your Python version check fails, try these steps:
- Try another command: On Windows, use py –version. On Mac or Linux, try the python3 –version.
- Check installation: Look for Python in your installed applications or use the official installer.
- Check PATH: Make sure your system can find the Python executable.
- Restart the terminal: Open a new terminal after installing Python or changing PATH settings.
- Check your editor: VS Code or PyCharm may use a different interpreter.
On Windows, the Microsoft Store alias may also affect how the python command behaves. Check your app execution aliases if the command opens the Store unexpectedly.
How to Check Multiple Python Versions Installed on Your Computer
You may have several Python versions installed for different projects. On Windows, run:
py -0p
This lists Python versions registered with the launcher and their paths. You can then check a specific version:
py -3.12 –version
On macOS or Linux, use your version manager or inspect the executable paths to identify separate installations.
What Is the Difference Between Python 2 and Python 3?
Python 2 is an older version that reached the end of official support in 2020. Python 3 is the standard choice for new projects and receives ongoing updates. Check the official Python version status before choosing a release.
If you want to learn Python through practical projects, LocalPro1 Institute offers training options. Explore our Python Courses In Rawalpindi to build your programming skills.
Conclusion
Checking your Python version takes only a few seconds. Use python –version on Windows or python3 –version on macOS and Linux. For code, use Python’s sys module.
If a command fails, check your installation, PATH, and selected interpreter before reinstalling Python. Contact us today at LocalPro1 Institute to learn more about our Python courses and build your programming skills.
FAQs
How do I check my Python version in CMD?
Open Command Prompt and run python –version. If that fails, try py –version.
What command shows the Python version?
Use python –version or python3 –version, depending on your system.
How do I check the Python 3 version?
Run python3 –version on macOS or Linux. On Windows, try py -3 –version.
Why is Python not recognized in Command Prompt?
Python may not be installed or added to PATH. Try the Python launcher or check your installation settings.
Can I have multiple Python versions installed?
Yes. You can use different versions for separate projects, provided each project uses the correct interpreter.

