pip install出错 not a trusted or secure host解决方案

本文介绍了解决使用sudopipinstallpackname时遇到的信任主机安全警告问题。通过修改pip配置文件~/.pip/pip.conf,指定信任的镜像源来避免安全警告,确保顺利安装Python包。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

使用sudo pip install packname时会提示错误:

The repository located at http://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’.

解决方法是,修改pip配置文件~/.pip/pip.conf如下:

[global]
timeout = 6000
index-url = http://pypi.douban.com/simple/
[install]
use-mirrors = true
mirrors = http://pypi.douban.com/simple/
trusted-host = pypi.douban.com

PS E:\表白程序> pip install playsound==1.2.2 WARNING: Ignoring invalid distribution -ip (e:\python\lib\site-packages) Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ 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 playsound==1.2.2 (from versions: none) ERROR: No matching distribution found for playsound==1.2.2 PS E:\表白程序> pip install --upgrade pip setuptools wheel WARNING: Ignoring invalid distribution -ip (e:\python\lib\site-packages) Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Requirement already satisfied: pip in c:\users\17670\appdata\roaming\python\python38\site-packages (25.0.1) 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'. Requirement already satisfied: setuptools in e:\python\lib\site-packages (69.0.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'. 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 wheel (from versions: none) ERROR: No matching distribution found for wheel
03-18
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值