pip 豆瓣镜像使用

pip install -i https://pypi.douban.com/simple/ flask

要用https的

https://pip.pypa.io/en/latest/user_guide/#configuration

三种配置位置

per-user, per-virtualenv or site-wide (shared amongst all users) configuration

If multiple configuration files are found by pip then they are combined in the following order:

Firstly the site-wide file is read, then

The per-user file is read, and finally

The virtualenv-specific file is read.

运行以下python代码会自动建立pip.ini

"""

python建立pip.ini.py

2016年4月30日 03:35:11 codegay

"""

import os

ini="""[global]

index-url = https://pypi.douban.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)

参考链接:

https://segmentfault.com/q/1010000000496093

你可能感兴趣的:(pip 豆瓣镜像使用)