{"id":762,"date":"2014-10-01T03:52:07","date_gmt":"2014-10-01T03:52:07","guid":{"rendered":"http:\/\/shivdev.com\/blog\/?p=762"},"modified":"2014-10-01T03:57:37","modified_gmt":"2014-10-01T03:57:37","slug":"find-out-modules-installed-by-pip","status":"publish","type":"post","link":"http:\/\/shivdev.com\/blog\/2014\/10\/01\/find-out-modules-installed-by-pip\/","title":{"rendered":"Find out modules installed by pip"},"content":{"rendered":"<p>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 <em>pip<\/em> within the context of that venv and then grep for a particular one. I&#8217;m not a super Python expert at this time, but wrote up a small script to list this.<\/p>\n<p>Here&#8217;s a python script:<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\n# pip_installed_modules.py \r\nimport pip\r\n\r\ndef main():\r\n\tmodules = pip.get_installed_distributions()\r\n\tfor m in modules:\r\n\t\tprint m\r\n\r\n\r\nif __name__ == &quot;__main__&quot;:\r\n    main()\r\n<\/pre>\n<p>Here&#8217;s my alias:<\/p>\n<blockquote><p>\nalias pipmodules=&#8217;python ~\/bin\/pip_installed_modules.py&#8217;\n<\/p><\/blockquote>\n<p>Now I can simply <em>grep<\/em> for specific modules or just see the installed modules.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;m not a super Python expert at this time, but wrote up a small script to list [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[32],"tags":[],"_links":{"self":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/762"}],"collection":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/comments?post=762"}],"version-history":[{"count":6,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/762\/revisions"}],"predecessor-version":[{"id":768,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/posts\/762\/revisions\/768"}],"wp:attachment":[{"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/media?parent=762"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/categories?post=762"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shivdev.com\/blog\/wp-json\/wp\/v2\/tags?post=762"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}