How to Check Python Version? (Linux, Windows and Mac)
You can check the Python version on different operating systems using the following methods:
Linux and Mac:
Open a terminal:
On Linux: Press
Ctrl + Alt + T
or use the application menu to open the terminal.On Mac: Press
Cmd + Space
, type "Terminal," and press Enter.
Type the following command:
bashCopy codepython --version
or
bashCopy codepython -V
or
bashCopy codepython3 --version
or
bashCopy codepython3 -V
This will display the Python version installed on your system.
Windows:
Open Command Prompt:
- Press
Win + R
, type "cmd," and press Enter.
- Press
Type the following command:
bashCopy codepython --version
or
bashCopy codepython -V
or
bashCopy codepython3 --version
or
bashCopy codepython3 -V
This will display the Python version installed on your system.
Alternative for all systems:
Open a terminal or command prompt:
Type the following command:
bashCopy codepython -c "import sys; print(sys.version)"
or
bashCopy codepython -c "import platform; print(platform.python_version())"
or
bashCopy codepython3 -c "import sys; print(sys.version)"
or
bashCopy codepython3 -c "import platform; print(platform.python_version())"
This will provide more detailed information about the Python version, including additional details such as the build and date.
Learn more with the free online python tutorial and test your knowledge with the online python compiler!