Python pip建立pip.ini 修改为Aliyun源下载三方模块

kikaylee 2020-05-03

"""
python建立pip.ini Aliyun源
2020年5月3日20:28:50 Venti Fang
"""

import os

ini = """
[global]
index-url = https://mirrors.aliyun.com/simple/
[install]
trusted-host=mirrors.aliyun.com
"""
pippath = os.environ["USERPROFILE"] + "\\pip\\"  #C:\Users\84788\pip\
# print(pippath)
if not os.path.exists(pippath):
    os.mkdir(pippath)

with open(pippath + "pip.ini", "w+") as f:
    f.write(ini)

相关推荐

huavhuahua / 0评论 2020-05-15
duanlove技术路途 / 0评论 2020-05-01