Replace the attribute access `sys.version_info.major` with tuple indexing `sys.version_info[0]` to support Python 2.6, which lacks the `.major` attribute added in 2.7. Additionally, guard the `subprocess.check_output()` call with a version check and provide a fallback using `subprocess.Popen` and `communicate()` for Python 2.6 environments where `check_output` is unavailable.