In this short guide, you’ll see two methods to find where Python is installed on Windows:
- Using the sys library
- Manually
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)
Here is an example of a path structure that you may get:
C:\Users\Ron\AppData\Local\Programs\Python\Python39
Manually Locate Where Python is Installed
Alternatively, you can manually locate where Python is installed by following these steps:
- Type ‘Python’ in the Windows Search Bar
- Right-click on the Python App, and then select “Open file location“
- 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:
C:\Users\Ron\AppData\Local\Programs\Python\Python39
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.