zoukankan      html  css  js  c++  java
  • python之更换pip默认安装源

    一、更换默认安装源

     1、Wndows系统

       在用户文件夹(C:Users对应用户目录)下创建pip目录,并在pip目录下创建pip.in文件(%HOMEPATH%pippip.ini),文件中添加如下内容:

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

       备注:index-url即源地址,trusted-host为源地址的域名,由于国内的源镜像都为使用https协议,所以如果不添加信任域就会报:

       This repository located at mirrors.aliyun.com is not a trusted host, if this repository is available via HTTPS it is recommend to use HTTPS instead, otherwise you may silence this warning with                              ‘–trusted-host mirrors.aliyun.com’.

       DEPRECATION: Implicitly allowing locations which are not hosted at a secure origin is deprecated and will require the use of –trusted-host in the future.

     2、Linux系统

      linux的文件在~/.pip/pip.conf

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

       3、手动指定:

      pip install -i http://<mirror>/simple <package> 或pip install  <package> -i http://<mirror>/simple

      例如:pip install -i http://mirrors.aliyun.com/pypi/simple/

  • 相关阅读:
    MongoDB学习(翻译6)
    MongoDB学习(翻译5)
    MongoDB学习(翻译4)
    MongoDB学习之--安全和认证
    MongoDB学习(翻译3)
    前端面试题—1
    静态网页制作
    风雨哈佛路感后感
    实习记录11
    实习记录10
  • 原文地址:https://www.cnblogs.com/Inbreeze/p/14176035.html
Copyright © 2011-2022 走看看