using sys.hexversion could be useful if you want to compare version in shell script
ret=`python -c 'import sys; print("%i" % (sys.hexversion<0x03000000))'`
if [ $ret -eq 0 ]; then
echo "we require python version <3"
else
echo "python version is <3"
fi