pypi 使用非 https 的镜像地址后无法使用,提示每次要加 `--trusted-host url` 来解决

之前一直是正常使用 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 吧?

阅读 18.6k
3 个回答

配置文件里加

trusted-host=mirrors.aliyun.com

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题