Listing installed python site
This question already has an answer here:
Check out yolk.
Yolk is a Python command-line tool and library for obtaining information about packages installed by setuptools, easy_install and distutils (Python 2.5) and for querying PyPI (Python Package Index aka The Cheese Shop).
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
You want sys.modules
.
import pprint, sys
pprint.pprint(sys.modules)
You can slice and dice from there.
链接地址: http://www.djcxy.com/p/26388.html下一篇: 列出已安装的python站点