Sometimes, we want to find the full path of the Python interpreter.
In this article, we’ll look at how to find the full path of the Python interpreter.
How to find the full path of the Python interpreter?
To find the full path of the Python interpreter, we can use the sys.executable property.
For instance, we write:
import sys
print(sys.executable)
Then print will print the path of the Python interpreter, which is something like '/opt/virtualenvs/python3/bin/python'.
Conclusion
To find the full path of the Python interpreter, we can use the sys.executable property.