pip stores packages in a folder specific to your Python installation
When you run pip install to add a package, pip downloads the code and places it in a directory called site-packages. This folder lives inside your Python installation, not in your project folder. The exact location depends on your operating system, whether you're using a virtual environment, and which Python version you have.
Understanding where packages land matters because it affects whether your code can find them, whether other projects can use them, and how to troubleshoot when something breaks. If you're getting "module not found" errors, the package is probably installed in the wrong location or in a Python version your script isn't using.
Key Takeaways
- pip installs packages into site-packages, a folder inside your Python installation, not into your project directory.
- On Windows, site-packages is usually at C:\Users\YourName\AppData\Local\Programs\Python\Python311\Lib\site-packages; on Mac and Linux it's typically in a hidden folder like ~/.local/lib/python3.11/site-packages.
- Using a virtual environment creates a separate site-packages folder for each project, preventing conflicts between packages needed by different scripts.
- You can find your exact site-packages location by running python -m site or checking inside a Python shell with import site; print(site.getsitepackages()).
Default location on Windows
On Windows, pip installs packages into a folder nested several levels deep inside your user profile. The path looks like C:\Users\YourName\AppData\Local\Programs\Python\Python311\Lib\site-packages, where YourName is your Windows username and 311 is your Python version number (it will be different if you have Python 3.10, 3.12, or another version).
The AppData folder is hidden by default in Windows File Explorer. To see it, open File Explorer, click the View tab at the top, and check the box labeled "Hidden items". Then navigate to your user folder and drill down through AppData → Local → Programs → Python → Python[version] → Lib → site-packages.
If you have multiple Python versions installed on the same machine, each one has its own separate site-packages folder. Running pip install adds the package only to whichever Python version's pip you used, so a package installed for Python 3.11 won't be visible to Python 3.10.
Default location on Mac and Linux
On Mac and Linux, pip installs into a hidden folder in your home directory. The path is typically ~/.local/lib/python3.11/site-packages, where the tilde (~) represents your home folder and 3.11 is your Python version. On some older Mac systems with Python installed via Homebrew, the path might be /usr/local/lib/python3.11/site-packages instead.
Because the folder starts with a dot, it's hidden from normal directory listings. To see it in the terminal, use ls -la instead of ls. In a graphical file manager, you can usually show hidden files through a View menu or keyboard shortcut (Command+Shift+Period on Mac).
Some systems also have a system-wide site-packages folder at /usr/lib/python3.11/site-packages where packages installed by your operating system's package manager live. Your user-level site-packages takes priority, so if you install the same package in both places, the one in your home directory is what Python will use.
How virtual environments change the location
A virtual environment is a separate Python installation folder that lives inside your project directory. When you create a virtual environment and activate it, pip installs packages into that environment's site-packages instead of your system Python's site-packages. This keeps each project's packages isolated from others.
If your project folder is called myproject and you create a virtual environment inside it, the site-packages folder will be at myproject/venv/lib/python3.11/site-packages on Mac and Linux, or myproject\venv\Lib\site-packages on Windows (assuming you named the environment folder venv(venv) before your command line.
Virtual environments prevent the problem of two projects needing different versions of the same package. Without them, upgrading a package for one project breaks the other. Most Python developers use a virtual environment for every project, even small ones.
Finding your exact site-packages location
The fastest way to find where pip is installing your packages is to run this command in your terminal: python -m site. This prints several paths, including the site-packages directories Python is currently searching. The first one listed is usually where pip will install new packages.
Another method is to open a Python shell by typing python at the terminal, then run these two lines:
import siteprint(site.getsitepackages())
This shows all the site-packages folders Python knows about. If you're in a virtual environment, you'll see only that environment's site-packages. If you're using the system Python, you'll see multiple paths — the user-level one and the system-wide one.
You can also check where a specific package landed after installing it. Run pip show packagename (replacing packagename with the actual package name) and look for the "Location:" line. This tells you exactly which site-packages folder that package is in.
Why "module not found" errors happen
The most common reason a script can't find a package you installed is that pip put it in one Python version's site-packages, but your script is running a different Python version. If you have both Python 3.10 and Python 3.11 installed, running pip install requests might use Python 3.10's pip, but then you run your script with python3.11 myscript.py, which can't see packages in Python 3.10's site-packages.
The fix is to be explicit about which Python you're using. Instead of pip install, run python -m pip install. This uses pip from whichever Python version you invoked, so python3.11 -m pip install requests installs into Python 3.11's site-packages, and then python3.11 myscript.py will find it.
Another common cause is installing packages globally but running your script inside a virtual environment. The virtual environment can't see the global site-packages by default. Activate the virtual environment first, then install the packages you need inside it.
Checking what's already installed
To see all the packages pip has installed in your current Python environment, run pip list. This shows the package name and version for everything in site-packages. If you're in a virtual environment, it shows only packages installed in that environment. If you're using system Python, it shows system packages plus anything you installed globally.
To see the contents of site-packages directly, navigate to the folder using your file manager or terminal. On Windows, you can paste the path into File Explorer's address bar. On Mac and Linux, use cd ~/.local/lib/python3.11/site-packages (adjusting the version number) to navigate there in the terminal, then ls to list the contents.
Each installed package is either a folder or a .py file. Larger packages are folders containing multiple files. You'll also see files ending in .dist-info or .egg-info — these are metadata folders that pip uses to track what's installed and what version it is.
Frequently Asked Questions
Can I change where pip installs packages?
Yes, but it's rarely necessary. You can pass the --target flag to install into a specific folder: pip install --target /path/to/folder packagename. However, this breaks the normal Python import system and causes problems later. Using a virtual environment is the standard way to control where packages go.
What happens if I delete the site-packages folder?
Your Python installation will stop working because site-packages contains the standard library and all installed packages. Don't delete it. If you want a clean Python installation, uninstall and reinstall Python, or create a new virtual environment.
Why do some packages install to different locations?
Some packages install scripts or data files outside site-packages. pip handles this automatically — the Python code goes in site-packages, but command-line tools might go in a bin or Scripts folder. This is normal and expected.
Do I need to know the site-packages location to use pip?
No. pip handles everything automatically. You only need to know where packages are if you're debugging import errors, moving a project between computers, or trying to understand why something isn't working.
What's the difference between site-packages and dist-packages?
On some Linux systems, the folder is called dist-packages instead of site-packages. They serve the same purpose. Debian and Ubuntu use dist-packages to separate system-managed packages from user-installed ones, but both are searched when Python imports modules.