In this short guide, you’ll see two methods to find where Python is installed on Windows:
- Using the sys library
Use the Sys Library to Find Where Python is Installed on Windows
You can use the sys library in order to find where Python is installed:
import sys locate_python = sys.exec_prefix print(locate_python)
For example, I got the following path when I ran the syntax in Python:
Manually Locate Where Python is Installed
Alternatively, you can manually locate where Python is installed by typing ‘Python’ in the Windows Search Bar:
Right-click on the Python App, and then select “Open file location” as captured below:
Right-click on the Python shortcut, and then select Properties:
Click on “Open File Location“:
You’ll now get the location/path where your Python is installed on Windows:
Notice that the path under this method matches to the path found under the first method.
Once you retrieved the above path, you’ll be able to upgrade pip for example.