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
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
docs.python.org โ€บ 3 โ€บ library โ€บ site.html
site โ€” Site-specific configuration hook โ€” Python 3.15.2 documentation
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).
๐ŸŒ
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?
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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.
Find elsewhere
๐ŸŒ
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
๐ŸŒ
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 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).
๐ŸŒ
CodeRivers
coderivers.org โ€บ blog โ€บ where-is-python-installed-on-windows
Where is Python Installed on Windows: A Comprehensive Guide โ€” CodeRivers
For example: C:\Users\YourUsername\AppData\Local\Programs\Python\Python314\python.exe C:\Scripts\hello.py ยท If you have the py launcher installed, you can also use: ... Python packages are installed in the site-packages directory within the Python installation.
๐ŸŒ
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 โ€บ 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
๐ŸŒ
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
๐ŸŒ
Python
svn.python.org โ€บ projects โ€บ python โ€บ trunk โ€บ Lib โ€บ site.py
site.py
This will append site-specific paths to the module search path. On Unix (including Mac OSX), it starts with sys.prefix and sys.exec_prefix (if different) and appends lib/python ยท /site-packages as well as lib/site-python. On other platforms (such as Windows), it tries each of the prefixes directly, as well as with lib/site-packages appended.