"which python" as a python command?

chardish at gmail.com chardish at gmail.com
Thu Sep 25 17:12:13 CEST 2008


I'm trying to find out in a script where the location of the current
python is. (I'm writing an installer script in python for a simple
server application, so i'm going to do a find-replace in a bunch of
files to give them the absolute path of the python binary.

One thought might be to use the subprocess module, run "which python"
as a subprocess, and then peek at stdout, but that seems way too
complicated. Is there a simple solution for this in just a few lines
of code?


More information about the Python-list mailing list