Python Site Packages Directory

In Python, there is a directory called ‘site-packages’, which is a location where the third-party packages are installed. It contains additional Python modules and libraries not included in the standard Python library.

when you install a package or module using ‘pip’, which is a python package installer then these packages are stored in the site-packages directory. you can install these packages globally (affecting the entire system) or within a virtual environment, which is an isolated Python environment where you can install packages without affecting the system-wide Python installation. Whenever you install a package, a subdirectory is created for the installed package in the site-package directory.

How to find the location of Python site-packages Directory?

Generally the version of Python installation and the operating system determines the exact location of the site-packages directory. Python has a module named as “site” which helps you to find the location. This location is always part of the PYTHONPATH (sys.path). Here is a code snippet that you can use to retrieve the location programmatically:

import site

site_packages_paths = site.getsitepackages()
print("Site-packages directories:")
for path in site_packages_paths:

In the above code getsitepackages() function returns the list of all global site-packages directories.

Alternatively, if you want to find the location of site-packages via the command line or terminal then you can use the following commands :

Windows Command Prompt:

python -m site --user-site

Linux/macOS Terminal:

python -m site --user-site

Sample Output

  1. On windows: It might be located as follows where XX represents the Python version.
  1. On Unix-based systems (such as Linux or macOS): It might be located as follows where X represents the major and Y represents the minor version of Python.