How to Check Python Version in Jupyter Notebook


If you are using Jupyter Notebook on your device locally and want to know what version of Python has been used, you can try one of the below options.

Option 1: Using sys module

    Add the below line of code into one of the cells and execute.

    import sys
    print(sys.version)
    
    Output:

    3.11.4 (main, Jul 25 2023, 17:36:13) [Clang 14.0.3 (clang-1403.0.22.14.1)

    As we can see from the output, I am using Python version 3.11.4 with my Notebook.

    Sys module to know Python Version Jupyter Notebook

Option 2: Running Python --version Command in Notebook

    Another way is by making use of the command - python --version in a cell.

    !python3 version
    !python version
    Python3 version in Jupyter Notebook

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap