title: Where does the shebang in tool-launching Python scripts come from?
body: <p>Several widely used Python tools — such as <code>pip</code>, <code>yolk</code> and <code>ipython</code> — are launched by scripts with a <a href="https://en.wikipedia.org/wiki/Shebang_%28Unix%29" rel="noreferrer">shebang</a> specifying what Python instance should be used to run them. How is the contents of this line determined?</p>
  
  <hr>
  
  <p>For example, on OS X machine, where I have been using Apple's Python, this line reads</p>
  
  <pre><code>#!/usr/bin/python
  </code></pre>
  
  <p>What would happen if I installed the python.org version, which is placed in</p>
  
  <pre><code>/Library/Frameworks/Python.framework/Versions/2.7/python 
  </code></pre>
  
  <p>with a symlink at </p>
  
  <pre><code>/usr/local/bin/python
  </code></pre>
  
  <p>and then updated or re-installed a tool? If I updated a tool would the line change? Would I have to fully reinstall (rather than simply updating) each tool to force a change? What would the line change to? Would it be</p>
  
  <pre><code>#!/usr/local/bin
  </code></pre>
  
  <p>or </p>
  
  <pre><code>#!/Library/Frameworks/Python.framework/Versions/2.7
  </code></pre>
  
  <p>Is there a way to make it</p>
  
  <pre><code>#!/usr/bin/env python
  </code></pre>