Check the module version number on the command line

python -c"import urllib3; print(urllib3.__version__)"

Bash Shell script to check Python module version number

examples/shell/python_module_version.sh

name=$1
if [ "$name" == "" ]
then
    echo Usage: $0 module_name
    exit 1
fi

python -c"import $name; print($name.__version__)"

Use:

chmod +a python_module_version.sh
./python_module_version.sh urllib3

Check Python module version number with a Linux Bash Shell function

examples/shell/python_module_version_function.sh


function module_version()
{
    name=$1
    if [ "$name" == "" ]
    then
        echo Usage: $0 module_name
        exit 1
    fi

    python -c"import $name; print($name.__version__)"
}

module_version urllib3


version=$(module_version urllib3)
echo before
echo $version
echo after