Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Listing installed python site-packages? [duplicate]

Tags:

python

django

from distutils.sysconfig import get_python_lib; print get_python_lib()

Returns: /usr/lib/python2.6/site-packages

import sys; print sys.path

Returns: ['', '/usr/lib/python2.6/site-packages/Django-1.1.1-py2.6.egg', '/usr/lib/python2.6/site-packages/pip-0.6.3-py2.6.egg', '/usr/lib/python2.6/site-packages/TRML2PDF-1.0-py2.6.egg', '/usr/lib/python2.6/site-packages/django_threaded_multihost-1.3_3-py2.6.egg',...............

But how to list the "importable name" from the site-packages installed? E.g: (before import results) django, pip, trm2pdf....

Thanks.

like image 587
panchicore Avatar asked Feb 20 '10 02:02

panchicore


1 Answers

pip is the one for the job, as it is a tool for installing and managing Python packages. After install you have to execute:

pip freeze

That will output the packages and version information in pips requirements format (can be used later to install those packages with one command). The format of the output is like:

querystring-parser==1.0
raven==1.4.6
requests==0.14.2
scipy==0.10.1
like image 119
Vajk Hermecz Avatar answered Oct 13 '22 06:10

Vajk Hermecz