Changed Python version check to use sys.version_info

The string `sys.version` should not be used for version checks as there's no guarantee the version number is at the beginning of the string. Instead the value `sys.version_info` should be used.