Fix cache with python-3.

Since sys.version_info[0] is an int, it is always inequal to '3'. This fixes a traceback issue when switching between python2/3 and caching.