Finding out the Python used to install the current package? -
this question has answer here:
- find full path of python interpreter? 5 answers
is there way programmatically find python version used install current package?
if have package called mypackage
, has in setup.py
like:
scripts = ["myscript.py"]
suppose install package easy_install
or pip
using particular python version, python 2.x:
/usr/local/bin/python2.x setup.py install
then in myscript.py
, how can find out /usr/local/bin/python2.x
used install mypackage
myscript.py
opposed other python version available on system? i'd know full path , not version info because want use /usr/local/bin/python2.x
in script.
use sys.executable
.
a string giving absolute path of executable binary python interpreter, on systems makes sense. if python unable retrieve real path executable, sys.executable empty string or none.
Comments
Post a Comment