@lru_cache(maxsize=<NUM_LIT>)<EOL>def get_python_version(path):<EOL>
version_cmd = [<EOL>path,<EOL>"<STR_LIT:-c>",<EOL>"<STR_LIT>",<EOL>]<EOL>try:<EOL><INDENT>c = vistir.misc.run(<EOL>version_cmd,<EOL>block=True,<EOL>nospin=True,<EOL>return_object=True,<EOL>combine_stderr=False,<EOL>write_to_stdout=False,<EOL>)<EOL><DEDENT>except OSError:<EOL><INDENT>raise InvalidPythonVersion("<STR_LIT>" % path)<EOL><DEDENT>if not c.out:<EOL><INDENT>raise InvalidPythonVersion("<STR_LIT>" % path)<EOL><DEDENT>return c.out.strip()<EOL>
Get python version string using subprocess from a given path.