Find out modules installed by pip
Writing by shivdev on Wednesday, 1 of October , 2014 at 3:52 am
We have a bunch of Python (2.7) virtual environments and I needed a way to figure out a way to list modules installed by pip within the context of that venv and then grep for a particular one. I’m not a super Python expert at this time, but wrote up a small script to list this.
Here’s a python script:
# pip_installed_modules.py
import pip
def main():
modules = pip.get_installed_distributions()
for m in modules:
print m
if __name__ == "__main__":
main()
Here’s my alias:
alias pipmodules=’python ~/bin/pip_installed_modules.py’
Now I can simply grep for specific modules or just see the installed modules.
Leave a comment
Category: Python
- Add this post to
- Del.icio.us -
- Digg -
- -
- Tweet -
-
-
No comments yet.
You must be logged in to post a comment.