How to list all installed packages and their versions in Python?

前端 未结 12 2017
灰色年华
灰色年华 2020-12-12 10:07

Is there a way in Python to list all installed packages and their versions?

I know I can go inside python/Lib/site-packages and see what files and direc

12条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-12 10:21

    from command line

    python -c help('modules')
    

    can be used to view all modules, and for specific modules

    python -c help('os')
    

    For Linux below will work

    python -c "help('os')"
    

提交回复
热议问题