Use sys.version_info to determine Python version

The string `sys.version` should not be used to determine the Python version as there's no guarantee the Python version is at the beginning of the string. The constant `sys.version_info` should be used instead.