ID EN
Shutil

which

Python 3.11

Return the path to an executable which would be run if the given cmd was called. If no cmd would be called, return None.

Syntax

PYTHON
shutil.which(cmd, mode=os.F_OK | os.X_OK, path=None)

Examples

Example 1
PYTHON
>>> shutil.which("python")
'C:\\Python33\\python.EXE'

See Also

os.access() os.environ() os.defpath which() bytes bytes bytes