title: How can I find the path for an executable?
body: <p>I need to setup environment with the path to a binary. In the shell, I can use <code>which</code> to find the path. Is there an equivalent in python?
  This is my code.</p>
  <pre class="lang-py prettyprint-override"><code>cmd = [&quot;which&quot;,&quot;abc&quot;]
  p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
  res = p.stdout.readlines()
  if len(res) == 0: return False
  return True
  </code></pre>