使用pip安装东西时太慢,甚至出现这样的报错时(HTTPSConnectionPool(host=‘files.pythonhosted.org’, port=443): Read timed out),就快点来和我一起运行一下下面这段代码,嘿嘿,让你快上天。
import os
ini="""[global]
index-url = https://pypi.doubanio.com/simple/
[install]
trusted-host=pypi.doubanio.com
"""
pippath=os.environ["USERPROFILE"]+"\\pip\\"
if not os.path.exists(pippath):
os.mkdir(pippath)
with open(pippath+"pip.ini","w+") as f:
f.write(ini)
拜拜~