1 Manually select the source of packages when using easy_install
Put such a file in your $HOME$ path:
[easy_install]
index-url=http://mirrors.tuna.tsinghua.edu.cn/pypi/simple
and name the file as : pydistutils.cfg
From now on the easy_install will use the index-url you just defined as a preferred source of packages.
More useful settings can be found here: Configure pydistutils.cfg - example python distutils config file
2 A python snippet to make updating easy_install package update easier
from setuptools.command.easy_install import main as install
from pkg_resources import Environment, working_set
import sys
plist = [dist.key for dist in working_set]
def autoUp():
for p in Environment():
try:
install(['-U', '-v'] + [p])
except:
print "Update of %s failed!"%p
print "Done!"
def stepUp():
for p in Environment():
a = raw_input("updating %s, confirm?(y/n)"%p)
if a== 'y':
try:
install(['-U'] + [p])
except:
print "Update of %s failed!"%p
else:
print "Skipping %s"%p
print "Done!"
print "You have %s packages currently managed through easy_install"%len(plist)
print plist
ans = raw_input('Do you want to update them... (N) not at all, (O) one by one, (A) All')
if ans == "N":
sys.exit()
elif ans == "O":
stepUp()
elif ans == "A":
autoUp()
else:
pass
Written with StackEdit.