pip报错WARNING: The repository located at mirrors .aliyun.com is not a trusted or secure host and

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

文章讲述了pip在下载软件包时遇到不受信任镜像源的警告,提供了解决方法,包括临时添加--trusted-hostmirrors.aliyun.com选项,以及如何在requirements.txt文件和pip配置文件中永久设置信任源

问题描述

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 waming and allow it anyway with '-trusted-host mirrors .aliyun.com"

解决思路

如果你确定这个镜像源是可信的,你可以使用"–trusted-host mirrors.aliyun.com"选项来允许pip使用它。具体的解决方法如下:

1.在使用pip下载软件包时,添加"–trusted-host mirrors.aliyun.com"选项,

例如:

pip install package_name(包名) --trusted-host mirrors.aliyun.com

2.如果你需要在requirements.txt文件中指定软件包依赖,

可以在执行pip install命令时添加"–trusted-host mirrors.aliyun.com"选项,
例如:

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

3.如果你想永久地添加这个镜像源,可以编辑pip的配置文件,将mirrors.aliyun.com添加到trusted-hosts选项中。

3.1配置阿里镜像源

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

3.2配置永久信任阿里镜像源

pip config set global.trusted-host mirrors.aliyun.com

3.3查看配置是否成功

pip config list

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/ # 可选,如果你也想指定索引 URL
trusted-hosts = mirrors.aliyun.com

您可能感兴趣的与本文相关的镜像

Python3.8

Python3.8

Conda
Python

Python 是一种高级、解释型、通用的编程语言,以其简洁易读的语法而闻名,适用于广泛的应用,包括Web开发、数据分析、人工智能和自动化脚本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Bruce-li__

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值