python - pypi 使用非 https 的镜像地址后无法使用,提示每次要加 `--trusted-host url` 来解决
怪我咯
怪我咯 2017-04-17 16:15:43
0
3
379

之前一直是正常使用 aliyun 的源,配置如下:

# ~/.pip/pip.conf [global] index-url = http://mirrors.aliyun.com/pypi/simple/

升级 pip 后,运行

>$ pip install virtualenv --upgrade 返回提示: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host mirrors.aliyun.com'. Requirement already up-to-date: virtualenv in /usr/local/lib/python2.7/site-packages

可以看到返回说 virtualenv 是最新的,实际上并没用更新。得运行下面的代码才能升级:

pip install virtualenv --upgrade --trusted-host mirrors.aliyun.com

怎么解决,总不能每次都加--trusted-host mirrors.aliyun.com吧?

怪我咯
怪我咯

走同样的路,发现不同的人生

全部回复 (3)
Peter_Zhu

配置文件里加

trusted-host=mirrors.aliyun.com

    洪涛

    换个支持 https 的源吧。比如下面这个:
    [global]
    index-url = https://pypi.mirrors.ustc.edu.cn/simple

      PHPzhong

      以下回答可能不礼貌

      4.6k声望的也是伸手党?
      您自己都还回答过 “SF怎么越来越水了” 的问题。

      随便Google以下都可以出来结果的问题。
      就算不会英语也有中文的链接的问题。
      同样用aliyun的其他人问题已经解决的贴出来的。

      而且无法理解的既然知道用conf文件了,不知道加配置吗?

      还是说我太菜无法理解这其中到底会有什么问题?

        最新下载
        更多>
        网站特效
        网站源码
        网站素材
        前端模板
        关于我们 免责声明 Sitemap
        PHP中文网:公益在线PHP培训,帮助PHP学习者快速成长!