| Command | Uses which Python? | Risk |
|---|---|---|
pytest | Whatever executable is first in PATH | May run wrong environment |
python -m pytest | The Python you explicitly called | Much safer |
cat $(which pytest)
The shebang line can show which “python” that pytest uses.
python -c "import sys; print(sys.executable)"
or
which python
This shows the interpreter you’re explicitly invoking.