1 """ 2 python建立pip.ini Aliyun源 3 2020年5月3日20:28:50 Venti Fang 4 """ 5 6 import os 7 8 ini = """ 9 [global] 10 index-url = https://mirrors.aliyun.com/simple/ 11 [install] 12 trusted-host=mirrors.aliyun.com 13 """ 14 pippath = os.environ["USERPROFILE"] + "\pip\" #C:Users84788pip 15 # print(pippath) 16 if not os.path.exists(pippath): 17 os.mkdir(pippath) 18 19 with open(pippath + "pip.ini", "w+") as f: 20 f.write(ini)