小墨の博客

梦想需要付诸行动,否则只能是梦

python更改下载源地址 (WARNING: The repository located at mirrors.aliyun.com is not a trusted )

python默认的pip源在国外,如果下载比较大的第三方库时可能会非常非常慢,甚至会报错,所以为了有一个更加友好的python使用体验,建议为python的pip换一下源。

python更改下载源地址

临时使用pip源:在使用pip时候,后面加上参数-i 镜像地址,例如

pip3 install xxx -i https://mirrors.aliyun.com/pypi/simple/


永久修改:

pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/


常用镜像源

豆瓣http://pypi.douban.com/
华中理工大学http://pypi.hustunique.com/
山东理工大学http://pypi.sdutlinux.org/
中国科学技术大学http://pypi.mirrors.ustc.edu.cn/
阿里云https://mirrors.aliyun.com/pypi/simple/


常见错误:不受信任的源

WARNING: The repository located at mirrors.aliyun.com is not a trusted

WARNING: 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'.


解决方法:根据错误提醒,添加 --trusted-host mirrors.aliyun.com 即可,如下

pip install -r requirements.txt --trusted-host mirrors.aliyun.com





关键词:pip国内镜像源

参考:https://blog.csdn.net/inthat/article/details/117030902

张小弟之家

本文链接:
文章标题:

本站文章除注明转载/出处外,均为原创,若要转载请务必注明出处。转载后请将转载链接通过邮件告知我站,谢谢合作。本站邮箱:admin@only4.work

尊重他人劳动成果,共创和谐网络环境。点击版权声明查看本站相关条款。

    发表评论:

    搜索
    本文二维码
    标签列表
    站点信息
    • 文章总数:508
    • 页面总数:20
    • 分类总数:92
    • 标签总数:208
    • 评论总数:61
    • 浏览总数:225323

    | | |
    | |  Z-Blog PHP