Assumptions:
- I'm not sure about the red hat, but for debian / ubuntu.
- I assume you are using system python.
- I don't think this is important, but you might need to check
pip install --user <package_name> for local package packages.
By default, packages are installed on the debian system:
/usr/lib/python2.7/dist-packages/
And installed packages are installed at:
/usr/bin/local/python2.7/dist-packages
To view all installation paths that you can run inside the python shell:
import site; site.getsitepackages() ['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
According to pip freeze, docs -l will show you any local package installations (i.e. not global packages). However, you need to be in the right environment.
pip freeze -l
If Virtualenvs come into play: They will use site-packages directories.
locate -r '/site-packages$'
Also note that any packages installed in another directory will not be found at all using this method: Install a Python package in another directory using pip?
Final trick . Check the exact installation path in pip using show pip. In fact, get only the names from pip, pipe that appear in show pip, and filter the output for the Name β Location map.
pip freeze | awk '{split($0,a,"="); print a[1]}' | xargs -P 5 -I {} pip show {} | grep 'Name\|Location'
source share