Where Does pip Install Packages?

python programs

Run the following command in your terminal to see the location where pip is installing the packages:

pip show <package_name>

If you want to know the location of all installed packages, then run the following command:

pip list -v

Note: Running pip show (outside of virtual environment) may give different answers if your system has multiple versions of python.

Hence it is recommended to run pip with specific python executables. For examples:

python -m pip show <package_name>
python3 -m pip show <package_name>

Where does pip install packages in a virtual environment?

The pip command in a virtual environment generally installs packages in the path <virtual_env>/lib/python<version>/site-packages/ or <virtual_env>/lib/site-packages/.

How to know the location of packages from a script?

Use getsitepackages() of the site module to get the locations of all packages in your system or virtual environment.

import site

Leave a Reply

Your email address will not be published. Required fields are marked *