import os
import pip
def calc_container(path):
total_size = 0
for dirpath, dirnames, filenames in os.walk(path):
for f in filenames:
fp = os.path.join(dirpath, f)
total_size += os.path.getsize(fp)
return total_size
for dist in pip.get_installed_distributions():
try:
path = os.path.join(dist.location, dist.project_name)
size = calc_container(path)
if size:
print path
print size
except OSError:
'{} no longer exists'.format(dist.project_name)
如果您在virtualenv中,您可以使用第一个选项获取更多:
get_installed_distributions(local_only=True, skip=('python', 'wsgiref', 'argparse'), include_editables=True, editables_only=False, user_only=False)
Return a list of installed Distribution objects.
If local_only is True (default), only return installations
local to the current virtualenv, if in a virtualenv.
我知道这很模糊,但这正是我想要的:
或者您可以通过以下网址获取列表:
http://hastebin.com/qiconesoje.apache
如果您在virtualenv中,您可以使用第一个选项获取更多:
相关问题 更多 >
编程相关推荐