Can I find the path to the python executable from inside python?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5927633/how-to-get-current-python-interpreter-path-from-inside-a-python-script">How to get current python interpreter path from inside a Python script?</a>  </p>
</blockquote>



<p>The title pretty much says it. I'd like to know which python executable is being used from inside python. Something like</p>

<pre>
Python 2.7.2 (default, Nov  1 2011, 03:31:17)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print &lt;insert the code I'm after here&gt;
/usr/local/bin/python2.7
>>>
</pre>

<pre>
Python 2.6.6 (r266:84292, Dec 27 2010, 00:02:40)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print &lt;insert the code I'm after here&gt;
/usr/bin/python2.6
>>>
</pre>

<p>You get the picture</p>

<p>Thanks</p>
