1 View the Python version number at the bottom of the Linux command line via Python-v
[Email protected]:~/sycworkspace/simple-sample$ python-v 2>&1 | awk ' {print $} '
Output Results Example: 2.7.3
2 Enter Python directly on the command line
Example:
[Email protected]:~/sycworkspace/simple-sample$ python
Python 2.7.3 (Default, Feb 27 2014, 19:58:35)
[GCC 4.6.3] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
3 Get the version number via Python's platform template
[Email protected]:~/sycworkspace/simple-sample$ python-c ' import platform; Print platform.python_version () '
2.7.3
4 Get the version number through the SYS module of Python
[Email protected]:~/sycworkspace/simple-sample$ python-c ' Import sys; Print Sys.version ' 2>&1
2.7.3 (Default, Feb 27 2014, 19:58:35)
[GCC 4.6.3]
You can get the version number by extracting the appropriate fields
[Email protected]:~/sycworkspace/simple-sample$ python-c ' Import sys; Print Sys.version ' 2>&1 | awk ' $1~/[0-9]. [0-9].*/{print} '
2.7.3
Get the version number of Python under Linu