title: Running Python script from shell invokes wrong interpreter
body: <p>Using Windows 7, I have three versions of Python installed.</p>
  
  <ul>
  <li><code>C:\tools\python2\python.exe</code></li>
  <li><code>C:\tools\python3\python.exe</code></li>
  <li><code>C:\users\adsmith\.virtualenvs\flask_project\Scripts\python.exe</code></li>
  </ul>
  
  <p>Running <code>where python</code> inside my virtualenv confirms this.</p>
  
  <pre><code>C:\Users\adsmith\.virtualenvs\flask_project\Scripts\python.exe
  C:\tools\python3\python.exe
  C:\tools\python2\python.exe
  </code></pre>
  
  <p>And running <code>python</code> within the virtualenv invokes the first interpreter</p>
  
  <pre><code>(flask_project) C:\Users\adsmith\workspace\flask_project\flaskr&gt;python
  Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 24 2015, 22:44:40) [MSC v.1600 64 bit (AMD64)] on win32
  Type "help", "copyright", "credits" or "license" for more information.
  &gt;&gt;&gt; import sys
  &gt;&gt;&gt; sys.executable
  'C:\\Users\\adsmith\\.virtualenvs\\flask_project\\Scripts\\python.exe'
  </code></pre>
  
  <p>However if I create a <code>.py</code> file inside the virtualenv and run it directly, it runs from the system Python 2 interpreter and I can't tell why. Running <code>python scriptname.py</code> works appropriately.</p>
  
  <pre><code>(flask_project) C:\Users\adsmith&gt;echo import sys; print(sys.executable) &gt; tmp.py
  
  (flask_project) C:\Users\adsmith&gt;tmp.py
  C:\tools\python2\Python.exe
  
  (flask_project) C:\Users\adsmith&gt;python tmp.py
  C:\Users\adsmith\.virtualenvs\flask_project\Scripts\python.exe
  </code></pre>
  
  <p>For reference:</p>
  
  <pre><code>(flask_project) C:\Users\adsmith&gt;assoc .py
  .py=Python.File
  
  (flask_project) C:\Users\adsmith&gt;ftype Python.File
  Python.File="python" "%1" %*
  </code></pre>