How can I get a list of locally installed Python modules?

前端 未结 30 2167
庸人自扰
庸人自扰 2020-11-22 04:32

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?

30条回答
  •  孤街浪徒
    2020-11-22 05:00

    From the shell

    ls site-packages
    

    If 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.

提交回复
热议问题