I would like to get a list of Python modules, which are in my Python installation (UNIX server).
How can you get a list of Python modules installed in your computer?
From stackoverflow
-
From the shell
ls site-packagesIf that's not helpful, you can do this.
import sys import os for p in sys.path: print os.listdir( p )And see what that produces.
vezult : which site-packages directory? This might do better: ls /usr/{local/,}lib/python$(python -V 2>&1|cut -d" " -f2 |cut -d. -f1-2)/site-packagesdF : Also this will not show built-in modules, or modules in a custom PYTHONPATH, or ones installed in setuptools "development mode" etc.Masi : My /usr/local/lib/python2.5/site-packages is empty, although I have installed modules.S.Lott : @dF: While true, I don't see how any of those alternatives are relevant to the question.S.Lott : @Masi: Interesting. You'll have to look at sys.path to see all the places they might have been put. -
help('modules')in a Python shell/prompt.
Masi : I get such a warning: FutureWarning: apt API not stable yet warnings.warn("apt API not stable yet", FutureWarning). I did not get a list of Python modules. I am using Python 2.5.ChristopheD : Could you paste the entire warning at for example http://paste.pocoo.org and post the link here?bobince : “/usr/lib/python2.5/site-packages/apt/__init__.py:18: FutureWarning: apt API not stable yet” is normal on Debian/Ubuntu Pythons, an artefact of attempting to graft apt packages into Python package management. I still see the (textual) list of modules.dF : Also `pydoc modules` from the shell should work.Abizern : @dF `pydoc modules` works. You should submit it as an answer.Masi : @Christopher: http://paste.pocoo.org/show/112078/Masi : @dF: pydoc modules, gives me the exactly same output as in python shell: help('modules')ChristopheD : @Masi: matplotlib related problem according to http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=519965 Should be fixed in the latest version available from http://matplotlib.sourceforge.net/ @Abizern: pydoc modules and help('modules') do the same thing...Masi : @ChristopheD: How can I see the version of my matplotlib? I tried import matplotlib; matplotlib --version unsuccessfully.
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.