what shebang to use for python scripts run under a pyenv virtualenv : <p>When a python script is supposed to be run from a <code>pyenv</code> <code>virtualenv</code> what is the correct shebang for the file?</p>

<p>As an example test case, the default python on my system (OSX) does not have <code>pandas</code> installed. The pyenv virtualenv <code>venv_name</code> does. I tried getting the path of the python executable from the virtualenv.</p>

<pre><code>$ pyenv activate venv_name
(venv_name)$ which python
/Users/username/.pyenv/shims/python
</code></pre>

<p><br/>
So I made my example <code>script.py</code>:</p>

<pre><code>#!/Users/username/.pyenv/shims/python
import pandas as pd
print 'success'
</code></pre>

<p><br/>
But when I tried running the script, I got an error:</p>

<pre><code>(venv_name) $ ./script.py
./script.py: line 2: import: command not found
./script.py: line 3: print: command not found
</code></pre>

<p><br/>
Although running that path on the command line works fine:</p>

<pre><code>(venv_name) $ /Users/username/.pyenv/shims/python script.py
success

(venv_name) $ python script.py # also works
success
</code></pre>

<p>What is the proper shebang for this? Ideally, I want something generic so that it will point at the python of whatever my current venv is.</p>
