python换了源之后pip会报错——com is not a trusted or secure host and is being ignored

python换了源之后pip会报错

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 we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
  Could not find a version that satisfies the requirement virtualenv (from versions: )
No matching distribution found for virtualenv

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 we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.

原因是国内源网站不被信任。

解决方法就是在pip install <包>后面加上--trusted-host mirrors.aliyun.com(这里看你自己当初添加的是什么国内源了)

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

猜你喜欢

转载自blog.csdn.net/bulletstart/article/details/131054835