Try
arcpy.GetInstallInfo()
You'll get a dictionary of keys and should be able to write some logic on that
{'SourceDir': u'C:\Users\kevi5105\Documents\ArcGIS
10.3\Desktop\SetupFiles\', 'InstallDate': u'5/5/2015', 'InstallDir': u'c:\program files (x86)\arcgis\desktop10.3\',
'ProductName': u'Desktop', 'BuildNumber': u'4322', 'InstallType':
u'N/A', 'Version': u'10.3', 'SPNumber': u'N/A', 'Installer':
u'kevin5', 'SPBuild': u'N/A', 'InstallTime': u'10:19:54'}
So, logic might be like:
try:
ver = float(arcpy.GetInstallInfo()['Version'])
except:
ver = 10.0
try:
sp = float(arcpy.GetInstallInfo()['SPNumber'])
except:
sp = 0
if ver >= 10.1 and sp > 1:
#do something
(I'm guessing at the SP # at 10.1... you may have to correct it)
floats is generally a bad idea. Consider10.2vs.10.10. Granted ESRI doesn't seem to have minor version numbers that high, but as a general principle, it's just a bad idea. You'd be better off to dover = tuple(int(i) for i in arcpy.GetInstallInfo()['Version'].split('.')). Then you specify your check later asver >= (10, 1). This will compare as expected, even for minor version numbers as high as 10.10. – jpmc26 Nov 10 '15 at 00:49longthe versions in our test harness and have look up tables (so we end up with values like 1005 or 1031). So whether you float, long, or tuple, they'll all work. – KHibma Nov 10 '15 at 14:05