how to list all installed modules

H

harryos

hi
Is there a way to list all the installed modules in my python
installation.I recently installed pygame and when i tried to import it
likeit complained that no such module was found.I can see the pygame
directory in F:\Python25\Lib\site-packages in my machine,but am unable
to import the module.So I was wondering if there is a way to list all
the installed modules

any help much appreciated
thanks
harry
 
P

Peter Otten

harryos said:
Is there a way to list all the installed modules in my python
installation.I recently installed pygame and when i tried to import it
like
it complained that no such module was found.I can see the pygame
directory in F:\Python25\Lib\site-packages in my machine,but am unable
to import the module.So I was wondering if there is a way to list all
the installed modules

may help to get a list of modules (if it doesn't fail with an exception as
over here).

Regarding the original problem, do you have multiple Python installations?
If so, you may accidentally be running the "wrong" python.

Peter
 
H

harryos

thanks Peter.That helped.
Regarding the original problem, do you have multiple Python installations?
If so, you may accidentally be running the "wrong" python.

I have only one installation.It shows all other modules.I will try
reinstalling .
regards,
harry
 
H

harryos

Are you running F:\Python25\python.exe (or F:\Python25\pythonw.exe)?
open a command window (run cmd), and type:
     C:\> python
     ...
     >>> import sys
     >>> for dirname in  sys.path:
             print sys.path

I suspect something you see printed will surprise you.
Either the banner, identifying a Python version you were
not expecting, or perhaps a bunch of C:-based directories.
If this does not help you decipher the problem, try running
      python -v
Python verbose mode (You will get a _lot_ of output).
Then, when you (finally) get a ">>>" prompt, type:
    >>> import pygame
and you will see eaxctly what lookups are tried.


thanks Scott for the detailed reply..
I reinstalled python and pygame and now things are working..:)
thanks again
harry
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top