"which python" as a python command?

C

chardish

Hello,

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?

Cheers,
Evan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top