How to get your current version of Python

Find Python Version!!

If you want to findout your current python version from terminal, then you can use below commands.

Python2

      
      · ~ $ python --version
      Python 2.7.18 :: Anaconda, Inc.
       
    
If you want to find out using code, you can use below snippet.
    
    import sys
    print sys.version_info
    print sys.version
    

Python3

    
    · ~ $ python --version
	Python 3.7.4
    
    
Similarly for Python3 you can use below snippet,
    
    import sys
    print(sys.version_info)
    print(sys.version)
    
    

0 comments:

Post a Comment