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
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
How to know the location of packages from a script?
getsitepackages() of the
site module to get the locations of all packages in your system or virtual environment.
import site site.getsitepackages()