Where does pip install its packages? Where does pip install its packages? python python

Where does pip install its packages?

pip show <package name> will provide the location for Windows and macOS, and I'm guessing any system. :)

For example:

> pip show cvxoptName: cvxoptVersion: 1.2.0...Location: /usr/local/lib/python2.7/site-packages

pip when used with virtualenv will generally install packages in the path <virtualenv_name>/lib/<python_ver>/site-packages.

For example, I created a test virtualenv named venv_test with Python 2.7, and the django folder is in venv_test/lib/python2.7/site-packages/django.

pip list -v can be used to list packages' install locations, introduced in https://pip.pypa.io/en/stable/news/#b1-2018-03-31

Show install locations when list command ran with “-v” option. (#979)

>pip list -vPackage                  Version   Location                                                             Installer------------------------ --------- -------------------------------------------------------------------- ---------alabaster                0.7.12    c:\users\me\appdata\local\programs\python\python38\lib\site-packages pipapipkg                   1.5       c:\users\me\appdata\local\programs\python\python38\lib\site-packages pipargcomplete              1.10.3    c:\users\me\appdata\local\programs\python\python38\lib\site-packages pipastroid                  2.3.3     c:\users\me\appdata\local\programs\python\python38\lib\site-packages pip...

This feature is introduced in pip 10.0.0b1. On Ubuntu 18.04 (Bionic Beaver), pip or pip3 installed with sudo apt install python-pip or sudo apt install python3-pip is 9.0.1 which doesn't have this feature.

Check https://github.com/pypa/pip/issues/5599 for suitable ways of upgrading pip or pip3.