2

Is there a way to find the path to any given system binary from within Python, similar to the bash command which?

I know I could use the subprocess or sh modules, but these either require me to launch a new process or install additional packages.

Is there a simple pythonic way of doing this?

Thanks!

1
  • 3
    This might be of use Commented Mar 2, 2016 at 9:21

1 Answer 1

3

Try distutils.spawn.find_executable, it tries to find executable in the directories listed in path.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.