Python (Scripting) - Return full path to the Python interpreter using sys.executable
by
Jeremy Canfield |
Updated: November 06 2023
| Python (Scripting) articles
Here is how you can print the full path to the Python interpreter.
#!/usr/bin/python3
import sys
print(f"Python interpreter = {sys.executable}")
Which should print something like this.
Python interpreter = /usr/bin/python
Or like this.
Python interpreter = /usr/bin/python3
Did you find this article helpful?
If so, consider buying me a coffee over at