- Python 3 Basic Tutorial
- Python 3 - Home
- What is New in Python 3
- Python 3 - Overview
- Python 3 - Environment Setup
- Python 3 - Basic Syntax
- Python 3 - Variable Types
- Python 3 - Basic Operators
- Python 3 - Decision Making
- Python 3 - Loops
- Python 3 - Numbers
- Python 3 - Strings
- Python 3 - Lists
- Python 3 - Tuples
- Python 3 - Dictionary
- Python 3 - Date & Time
- Python 3 - Functions
- Python 3 - Modules
- Python 3 - Files I/O
- Python 3 - Exceptions
- Python 3 Advanced Tutorial
- Python 3 - Classes/Objects
- Python 3 - Reg Expressions
- Python 3 - CGI Programming
- Python 3 - Database Access
- Python 3 - Networking
- Python 3 - Sending Email
- Python 3 - Multithreading
- Python 3 - XML Processing
- Python 3 - GUI Programming
- Python 3 - Further Extensions
How do I check what version of Python is running my script?
Python version is displayed on console immediately as you start interpreter from command line
C:\Users\acer>python Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.
Version information is present in version attribute defined in sys module
>>> import sys >>> sys.version '3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 18:41:36) [MSC v.1900 64 bit (AMD64)]'
Another attribute version_info is more elaborate. It provides major, minor and micro version levels.
>>> import sys >>> sys.version_info sys.version_info(major=3, minor=6, micro=1, releaselevel='final', serial=0)
There is also hexversion attribute which provides a unique number associated with the version. If converted using hex() function, it indicates the version.
>>> sys.hexversion 50725360 >>> hex(50725360) '0x30601f0'
- Related Articles
- What environment variables do I need to set up before I start running Java programs on my machine?
- How I can check a Python module version at runtime?
- Which version is my MySQL?
- What is a Test Script and how do I write one?
- My Python program is too slow. How do I speed it up?
- How to check version of python modules?
- How can I check the version of MySQL Server?
- How to check Syntax of a Bash Script without running it in Linux?
- How do I install selenium latest version?
- How do I make an executable from a Python script?
- How do I find the location of my Python site-packages directory?
- How to manipulate figures while a script is running in Python Matplotlib?
- What Should I Do If My IP Address Is Exposed?
- How to check the syntax of a Bash script without running it in Linux?