To check the Python version on Mac, follow the below steps.
- Open the terminal for Mac.
- Type the Python –version command
- Execute it, and it will return the installed version of Python.
python --version
Checking the Python version on Windows
To check the Python version on Windows:
- Open the command prompt application(CMD) for Windows.
- Type the Python –version command
- Execute it, and it will return the installed version of Python.
If you type the same in Windows Shell or Command line, you will get the installed version of Python.
If the Python –version does not work in Linux or Windows, you can also write one of the following commands.
- python -V
- python -VV
Installing Python, updating it, installing packages and third-party software like Anaconda, and installing and updating pip are some of the most frequently used operations users perform in their system.
Checking Python Version using Script
You can check a Python version using a script by importing the sys module and using the sys.version expression, it returns the installed version of Python in your system.
import sys
print(sys.version)
Output
3.10 (default, Dec 22 2021, 13:24:00)
[Clang 13.0.0 (clang-1300.0.29.3)]
That’s it for pretty much it.