Within IPython how to get the path of the Python driver
Question: When I am running a script get the path of Python kernel (not mater if it is
Python, IPython, or IPython Notebook with non-standard kernel, where I can
switch between Py2 and Py3).

When writting (in IPython)

    
    
    import sys
    sys.argv
    

I get the path to IPython: `['/usr/local/bin/ipython']`.

Is it possible to get the path to Python as well?

I need it so to match versions of Python from IPython (Notebook) to Spark
worker (`PYSPARK_PYTHON`).


Answer: A general way to do so (i.e. working both in scripts, ipython shell and
IPython Notebook) is:

    
    
    import sys
    sys.executable
    

([Thx
Carreau](https://github.com/minrk/findspark/issues/6#issuecomment-132625554)!)

