Use sys.version_info to determine Python version

The string `sys.version` should not be used for version checks as there's no guarantee the version number will be at the beginning.