def executable_exists ( executable ) : for directory in os . getenv ( "PATH" ) . split ( ":" ) : if os . path . exists ( os . path . join ( directory , executable ) ) : return True return False
heck if environemnt variabl eexists python
Test if an executable is available on the system .
def executable_exists(executable):
    """Test if an executable is available on the system."""
    for directory in os.getenv("PATH").split(":"):
        if os.path.exists(os.path.join(directory, executable)):
            return True
    return False