Reputation: 938
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!
Upvotes: 2
Views: 575
Reputation: 46
Try distutils.spawn.find_executable, it tries to find executable in the directories listed in path.
Upvotes: 3