Bootstrap FreeKB - Python (Scripting) - Return full path to the Python interpreter using sys.executable
Python (Scripting) - Return full path to the Python interpreter using sys.executable

Updated:   |  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 Buy Me A Coffee



Comments


Add a Comment


Please enter ae1407 in the box below so that we can be sure you are a human.