sys.version_info
A value in the sys module that tells a running program exactly which Python version it is, as major, minor and micro numbers.
In more detail
It behaves like a tuple, so you can compare it, for example sys.version_info >= (3, 10). The course uses it to ask the interpreter about itself rather than guessing. sys.version gives the same information as a longer string including build details.
Example
import sys
print(sys.version_info)Related terms
- sys module — The standard library module through which a program asks the running interpreter about itself.
- version number — A label such as 3.14.7 whose three parts name the major version, the minor feature release and the micro bug-fix release.
- tuple — An ordered, fixed-length group of values in which each position can have its own meaning and type.
Taught in
- What Python Is, And Where It Came From — Hands-on Python: Complete Video Course & Book
- Installing Python On A Mac — Hands-on Python: Complete Video Course & Book
- Installing Python On Linux — Hands-on Python: Complete Video Course & Book
- Where Python Lives: PATH And Versions — Hands-on Python: Complete Video Course & Book