site-packages is the target directory of manually built Python packages. When you build and install Python packages from source (using distutils, probably by executing python setup.py install), you will find the installed modules in site-packages by default.

There are standard locations:

  • Unix (pure)1: prefix/lib/pythonX.Y/site-packages
  • Unix (non-pure): exec-prefix/lib/pythonX.Y/site-packages
  • Windows: prefix\Lib\site-packages

1 Pure means that the module uses only Python code. Non-pure can contain C/C++ code as well.

site-packages is by default part of the Python search path, so modules installed there can be imported easily afterwards.


Useful reading

  • Installing Python Modules (for Python 2)
  • Installing Python Modules (for Python 3)
Answer from Omer Dagan on Stack Overflow
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ site.html
site โ€” Site-specific configuration hook โ€” Python 3.15.1 ...
2 weeks ago - Changed in version 3.3: Importing the module used to trigger paths manipulation even when using -S. It starts by constructing up to four directories from a head and a tail part. For the head part, it uses sys.prefix and sys.exec_prefix; empty heads are skipped. For the tail part, it uses the empty string and then lib/site-packages (on Windows) or lib/pythonX.Y[t]/site-packages (on Unix and macOS).
Top answer
1 of 16
1184

There are two types of site-packages directories, global and per user.

  1. Global site-packages ("dist-packages") directories are listed in sys.path when you run:

     python -m site
    

    For a more concise list run getsitepackages from the site module in Python code:

     python -c 'import site; print(site.getsitepackages())'
    

    Caution: In virtual environments getsitepackages is not available with older versions of virtualenv, sys.path from above will list the virtualenv's site-packages directory correctly, though. In Python 3, you may use the sysconfig module instead:

     python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'
    
  2. The per user site-packages directory (PEP 370) is where Python installs your local packages:

     python -m site --user-site
    

    If this points to a non-existing directory check the exit status of Python and see python -m site --help for explanations.

    Hint: Running pip list --user or pip freeze --user gives you a list of all installed per user site-packages.


Practical Tips

  • <package>.__path__ lets you identify the location(s) of a specific package: (details)

      $ python -c "import setuptools as _; print(_.__path__)"
      ['/usr/lib/python2.7/dist-packages/setuptools']
    
  • <module>.__file__ lets you identify the location of a specific module: (difference)

      $ python3 -c "import os as _; print(_.__file__)"
      /usr/lib/python3.6/os.py
    
  • Run pip show <package> to show Debian-style package information:

      $ pip show pytest
      Name: pytest
      Version: 3.8.2
      Summary: pytest: simple powerful testing with Python
      Home-page: https://docs.pytest.org/en/latest/
      Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others
      Author-email: None
      License: MIT license
      Location: /home/peter/.local/lib/python3.4/site-packages
      Requires: more-itertools, atomicwrites, setuptools, attrs, pathlib2, six, py, pluggy
    
2 of 16
707
>>> import site; site.getsitepackages()
['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']

(or just first item with site.getsitepackages()[0])

๐ŸŒ
Python.org
discuss.python.org โ€บ python help
Site Packages location - Python Help - Discussions on Python.org
September 30, 2022 - Iโ€™m trying to find the site packages folder to save my modules to. Iโ€™m using Windows 10 Home, I have looked everywhere and canโ€™t find it. Can someone tell me an easy way to get to it?
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ get-location-of-python-site-packages-directory
Get Location of Python site-packages Directory - GeeksforGeeks
July 23, 2025 - Finding the site-packages directory containing all the packages installed in the Python distribution. Finding the package directory of a specific package/library. The Global site-packages directory (or dist-packages) could be located by running the following command in the command interpreter (cmd.exe or terminal) of your Operating System: ... This gives a list of all the packages installed on the user and base sites, including the directories listed in the sys.path file.
๐ŸŒ
Codemia
codemia.io โ€บ home โ€บ knowledge hub โ€บ how do i find the location of my python site-packages directory?
How do I find the location of my Python site-packages directory? | Codemia
December 28, 2024 - The fastest way to find your Python site-packages directory is to run python -m site or python -c "import site; print(site.getsitepackages())". The site-packages directory is where pip installs third-party packages for a specific Python interpreter, and its location varies depending on the operating system, the Python version, and whether you are using a virtual environment, Conda, or the system interpreter. The critical detail is that site-packages is not a machine-wide directory. It belongs to a specific interpreter installation. If you check the wrong interpreter, you get the wrong path, even if the commands themselves are correct.
๐ŸŒ
Python Module of the Week
pymotw.com โ€บ 2 โ€บ site
site โ€“ Site-wide configuration - Python Module of the Week
The USER_SITE path name is created using the same platform-specific values described above. $ python site_user_base.py Base: /Users/dhellmann/.local Site: /Users/dhellmann/.local/lib/python2.7/site-packages ยท The user base directory can be set through the PYTHONUSERBASE environment variable, and has platform-specific defaults (~/Python$version/site-packages for Windows and ~/.local for non-Windows).
๐ŸŒ
GitHub
github.com โ€บ tox-dev โ€บ tox โ€บ issues โ€บ 2402
[Windows] User site-packages is not added to python path when running test with sitepackages = true ยท Issue #2402 ยท tox-dev/tox
April 16, 2022 - In Windows, the default user site-packages location is %APPDATA%\Python\PythonXY\site-package. If %APPDATA% doesn't exist, python won't find the user site-packages folder and won't add it to the python path. When using tox with the sitep...
Author: tox-dev
Find elsewhere
๐ŸŒ
CodeRivers
coderivers.org โ€บ blog โ€บ where-are-python-packages-installed
Understanding Where Python Packages are Installed - CodeRivers
July 21, 2026 - For example, if you have Python 3.12 installed, the packages will be in /usr/local/lib/python3.12/site-packages. On Windows, the system-wide installation directory is usually something like C:\Python3X\Lib\site-packages, where 3X is the Python version (e.g., C:\Python312\Lib\site-packages).
๐ŸŒ
Python Packaging
packaging.python.org โ€บ tutorials โ€บ installing-packages
Installing Packages - Python Packaging User Guide
For example, this could return C:\Users\Username\AppData\Roaming\Python36\site-packages so you would need to set your PATH to include C:\Users\Username\AppData\Roaming\Python36\Scripts. You can set your user PATH permanently in the Control Panel.
๐ŸŒ
YouTube
youtube.com โ€บ watch
Where is the site-packages folder? - YouTube
This video describes where to find the site-packages folder for storing modules that you want to import. Windows, Linux, and MacOSX are shown.
Published: August 26, 2009
๐ŸŒ
Readthedocs
cdce8p-python-peps.readthedocs.io โ€บ pep-0250
PEP 250 โ€“ Using site-packages on Windows | peps.python.org
The site.py module distributed with Python includes support for locating other modules in the site-packages directory. This PEP proposes that the site-packages directory should be used on the Windows platform in a similar manner. On Windows platforms, the default setting for sys.path does not include a directory suitable for users to install locally developed modules.
๐ŸŒ
YouTube
youtube.com โ€บ watch
How to find the location of Python site-packages directory - YouTube
How to find the location of Python site-packages directory
Published: May 11, 2019
๐ŸŒ
YouTube
youtube.com โ€บ bytive
How do I find the location of my Python site-packages directory? - YouTube
Thanks for watching this video !Don't forget to drop a like and share it with your friends !Subscribe to the Hackanon's channel for more such interesting vid...
Published: June 29, 2022
Views: 3K
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ how-do-i-find-the-location-of-my-python-site-packages-directory
How do I find the location of my Python site-packages directory?
March 24, 2026 - You can also find site-packages directories by running this command in your terminal. It prints all known site directories for the active Python interpreter ? ... sys.path = [ 'C:\current\directory', 'C:\Python312\python312.zip', 'C:\Python312\DLLs', 'C:\Python312\Lib', 'C:\Python312', 'C:\Python312\Lib\site-packages', ] USER_BASE: 'C:\Users\username\AppData\Roaming\Python' USER_SITE: 'C:\Users\username\AppData\Roaming\Python\Python312\site-packages' ENABLE_USER_SITE: True
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ find the location of python site-packages directory
Find the Location of Python site-packages Directory - Spark By {Examples}
May 31, 2024 - How do I find the location of my Python site-packages directory? The "site-packages" directory is where third-party packages are installed for Python. In