93

I've installed a Python package using pip, which is a replacement for easy_install. How do I get a list of which installed files are associated with this package?

Basically, I'm looking for the Python package equivalent of

dpkg -L

or

rpm -ql
user123456
  • 563
  • 1
  • 7
  • 20
Lorin Hochstein
  • 5,028
  • 15
  • 56
  • 72

3 Answers3

127

You could do that by using command:

pip show -f <package>
Bunyk
  • 1,442
  • 2
  • 13
  • 16
6

Two years later, most pip instances have show, however, not all packages have the installed-files.txt program for the subcommand to read.

A workaround is to fire up the python shell and do this:

>>> import eventlet
>>> eventlet.__path__
    ['/usr/lib/python2.7/dist-packages/eventlet']

where "eventlet" is the package I installed with pip.

coyot
  • 161
  • 1
  • 1
4

I use virtualenv with pip, so here are the steps I follow. Assume I'm working in the dave_venv virtual environment.

$ cat ~/.bashrc

export WORKON_HOME=/usr/local/virtualenvs

$ cd /usr/local/virtualenvs/dave_venv/lib/python2.6/site-packages
$ ls # This should show <your_package>.
$ cd <your_package>
$ ls # now you're looking at your package's files.
Dave Aaron Smith
  • 289
  • 1
  • 2
  • 10
  • 1
    works in most cases, but not if the package installs any command-line scripts, which would end up in usr/local/bin.... also, some packages may install multiple modules... – hwjp Oct 31 '12 at 11:33
  • @hwjp Do you know the answer to: [Find which python package owns a binary](https://stackoverflow.com/questions/55864568/find-which-python-conda-package-owns-a-binary)? – Tom Hale Apr 27 '19 at 06:26