Use sys.version_info instead of sys.version to obtain Python version

The string `sys.version` should not be used as there is no guarantee that the version number is at the beginning of the string.