How to Check the Python Version on Windows, Mac, and Linux


    A laptop screen with the Python logo on display.
    monticello/Shutterstock.com

    To check what version of Python is installed on your Windows, Mac, or Linux computer, all you have to do is run a single command. We’ll show you how to do that as well as what to do if you have multiple Python versions installed.

    RELATED: What Is Python?

    How to Read the Python Versions

    A Python version consists of three values: a major version, a minor version, and a micro version. An example of a Python version is:

    Python 3.10.4

    In the above version, 3 refers to Python’s major version. The second digit, which is 10, refers to Python’s minor version, and the last digit, 4, indicates the micro version of Python.

    Python’s major versions are generally not compatible with each other, but the minor ones are.

    Check the Python Version on Windows

    On your Windows PC where you’ve installed Python, use the PC’s built-in PowerShell utility to check the version number.

    To start, open your “Start” menu and search for “Windows PowerShell” (without quotes). Then click the utility in the search results.

    Select "Windows PowerShell."

    When PowerShell opens, type the following command and press Enter:

    python --version

    Access the Python version in PowerShell.

    PowerShell will display the version of Python installed on your PC.

    View the Python version in PowerShell.

    And that’s it.

    RELATED: How to Install Python on Windows

    View the Python Version on Mac

    On your Mac, you’ll use the pre-installed Terminal app to view your Python version.

    Launch Terminal by first opening Spotlight (using the Command+Space shortcut) and then searching for and clicking on “Terminal.”

    On the Terminal window, type the following command and press Enter:

    python --version

    Your current Python version will be displayed.

    RELATED: 16 Terminal Commands That Every Mac User Should Know

    Checking the Python Version on Linux

    To check the installed Python version on Linux, open a Terminal window (you can often use the shortcut Ctrl+Alt+T), type the following command, and press Enter:

    python --version

    The terminal will output your current Python version.

    RELATED: How to Launch a Terminal Window on Ubuntu Linux

    What If Your Computer Has Multiple Python Versions Installed?

    You could have multiple Python versions installed at the same time on your computer. This is because some apps use the newer Python 3 while others still rely on Python 2.7 in order to run. In this case, to find the version of each instance of Python, you’ll use the following commands.

    To check Python 2.7’s version, use this command:

    python --version

    For Python 3, use the following command:

    python3 --version

    And you’re all set.


    Wondering what version of PowerShell you’re running on your PC? It’s equally to find that information.

    RELATED: How to Check the PowerShell Version in Windows 10





    Source link

    Previous articleElon Musk Says Apple’s 30% App Store Fee is ‘Literally 10 Times Higher Than It Should Be’
    Next articleThe Razer Blade 15’s 240Hz OLED panel pushes laptop displays to new frontiers