pip 更换镜像源

 

 

临时更换镜像源

pip3 install 库名 -i 镜像地址

示例:

  • 安装 django-excel 库 并使用 阿里云 的镜像源
  • pip3 install django-excel -i https://mirrors.aliyun.com/pypi/simple/

     

Windows下更换镜像源

打开我的电脑,在地址栏中输入 %APPDATA% 按回车跳转到目标目录。在目录下创建一个pip文件,再其内部创建一个pip.ini 文件。输入以下信息。以阿里云为例

[global]
timeout = 6000
index-url = https://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

  注意:不管你用的是pip3还是pip,方法都是一样的,都是创建pip文件夹。

 

Linux 或者Mac环境替换镜像源:

 

创建配置文件 ~/.pip/pip.conf

[root@server01 ~]# mkdir -p ~/.pip
[root@server01 ~]# touch  ~/.pip/pip.conf

pip.conf配置镜像源

[global]
timeout = 6000
index-url = https://mirrors.aliyun.com/pypi/simple/
trusted-host = mirrors.aliyun.com

 

posted @ 2020-02-22 11:32  cl94  阅读(533)  评论(0编辑  收藏  举报