How to specify which python to use when writing vim script in python
<p>I started to learn how to write vim script in python.</p>

<p>I come across of this tutorial</p>

<p><a href="https://dzone.com/articles/how-write-vim-plugins-python" rel="nofollow">https://dzone.com/articles/how-write-vim-plugins-python</a></p>

<p>and my first vim script looks like the following</p>

<pre><code>function! Reddit()

python &lt;&lt; EOF
import sys
print sys.executable
print "hello Reddit"
EOF

endfunction
</code></pre>

<p>as you can see, the <code>print sys.executable</code> prints out the python on the system path.</p>

<p>As I use pyenv a lot, how can I set vim to recognize my python according to my working environment?</p>

<p>If you donât mind using Neovim instead of vim, you would be able to select which Python interpreter to use via:</p>

<pre><code>let g:python_host_prog = '/path/to/your/interpreter/python'
let g:python3_host_prog = '/path/to/your/interpreter/python3'
</code></pre>

python vim