Home

sitepackages

Site-packages is the directory in a Python installation where third-party packages are installed and made available for import. It is part of the interpreter’s search path, so modules and packages placed there can be imported by Python code without special configuration.

Location and layout vary by platform and Python version. Commonly, the directory is named site-packages and

There can be multiple site-packages directories in a Python environment. A standard global installation uses the

Python discovers site-packages at startup through the site module, which appends relevant paths to sys.path so

Pip and similar packaging tools install packages into site-packages by default. Understanding site-packages is important for

resides
under
lib/pythonX.Y/site-packages
(for
example,
lib/python3.11/site-packages
on
Unix-like
systems)
or
under
Lib\site-packages
on
Windows.
Some
operating
systems
and
distributions
also
use
a
separate
dist-packages
location
for
system-packaged
Python
components,
such
as
/usr/lib/pythonX.Y/dist-packages,
in
addition
to
or
instead
of
site-packages.
system-wide
site-packages,
while
virtual
environments
(venvs)
create
their
own
isolated
site-packages
directory
so
installed
packages
do
not
affect
the
global
Python
installation.
In
addition,
Python
supports
per-user
installations
via
the
--user
option,
which
places
packages
in
a
user-specific
site-packages
directory
that
participates
in
module
discovery.
that
imported
packages
can
be
located.
Variables
such
as
PYTHONPATH
or
the
per-user
PYTHONUSERBASE
can
influence
the
search
paths.
managing
dependencies,
creating
reproducible
environments,
and
troubleshooting
import
errors.