Python pip安装第三方库的国内镜像

国内源:

豆瓣:http://pypi.douban.com/simple/

清华:https://pypi.tuna.tsinghua.edu.cn/simple

阿里云:http://mirrors.aliyun.com/pypi/simple/

使用方法如下:

pip3 install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com django ==1.11.9

 

python -m pip3 install --upgrade pip3 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com

永久修改,一劳永逸:

Linux/Mac下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)

Linux下还可以创建在/etc/pip.conf

windows下,直接在user\AppData\Roaming目录中创建一个pip目录,再新建文件pip.ini。(例如:C:\Users\Administrator\AppData\Roaming\pip)

内容如下:

[global]
index-url = http://pypi.douban.com/simple/
[install]
trusted-host = pypi.douban.com

  

posted @ 2020-02-09 00:18  Wollf  阅读(106)  评论(0)    收藏  举报