Assumptions:
- I'm not sure about red-hat, but for debian/ubuntu.
- I'm assuming you are using system python.
- I don't think it matters, but you might have to check
pip install --user <package_name>
for local user package installs.
By default on debian system installed packages are installed at:
/usr/lib/python2.7/dist-packages/
And pip installed packages are installed at:
/usr/bin/local/python2.7/dist-packages
To see all the installation paths you can run inside your python shell:
import site; site.getsitepackages()
['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
As per the pip freeze docs-l
will show you any local installs of packages (i.e. not global packages) However, you need to be in the correct environment.
pip freeze -l
If Virtualenvs come into play: They will use site-packages
directories.
locate -r '/site-packages$'
Also note any packages installed into a different directory will not be located at all via this method: Install a Python package into a different directory using pip?
Final trick,
Check the exact install path in pip using pip show. Effectively, get just the names from pip, pipe that into a pip show 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'