By script
import sys
print(sys.version) # '3.8.5 (default, Aug 18 2020, 14:42:26) \n[GCC 9.3.0]'
print(sys.version_info) # sys.version_info(major=3, minor=8, micro=5, releaselevel='final', serial=0)
print(sys.version_info.major) # 3
print(sys.version_info.minor) # 8
from platform import python_version
print(python_version()) # '3.8.5'
By shell
$ python -V
Comentários