check python version ubuntu code example
Example 1: check ubuntu version
lsb_release -a
Example 2: how to check python version
# To check your Python version in the command line use:
python --version
# To check your Python verson inside a script use:
import sys
print(sys.version)
Example 3: check all python versions ubuntu
# View as version vise:
for p in $(compgen -c python); do printf "%-16s" $p; $p --version; done
python2.7 Python 2.7.6
python3.4m Python 3.4.3
# view as:
$ compgen -c python
python2.7
python3.4m
Example 4: python version command notebook
import platform
print(platform.python_version())
Example 5: check python version ubuntu
python3 --version