ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

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

2021-05-19 15:59:39  阅读:759  来源: 互联网

标签:源地址 repository mirrors python pypi aliyun pip com trusted


文章目录

python更改下载源地址

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

临时使用pip源

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

pip3 install pygame -i http://mirrors.aliyun.com/pypi/simple/

永久修改:

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

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

[root@localhost bin]# ./pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
Writing to /root/.config/pip/pip.conf

工作中遇到的问题总结

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’.
ERROR: Could not find a version that satisfies the requirement Pillow3.4.2 (from versions: none)
ERROR: No matching distribution found for Pillow
3.4.2
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 即可,如下

[root@localhost bin]# ./pip install -r requirements.txt --trusted-host mirrors.aliyun.com

标签:源地址,repository,mirrors,python,pypi,aliyun,pip,com,trusted
来源: https://blog.csdn.net/inthat/article/details/117030902

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有