如果pip出现换了源都不行的操作,那么你可以试试这种方法

本文分享如何通过 '--trusted-host' 参数解决pip安装过程中遇到的ProxyError和不信任源警告,重点讲解了使用'http://pypi.douban.com/simple/' 作为可信源并成功安装pyqt5的实例。

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

我遇到过的两个错误

第一个:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', timeout('_ssl.c:732: The handshake operation timed out',))': /simple/%20--trusted-host%20pypi.douban.com/pyqt5-tools/

 第二个:

 The repository located at pypi.tuna.tsinghua.edu.cn 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 pypi.tuna.tsinghua.edu.cn'.
  Could not find a version that satisfies the requirement pyqt5 (from versions: )
No matching distribution found for pyqt5

 

只需要以下这条命令,轻松解决

pip install package -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

注意需要讲package换成你需要的包

这时候安装就成功了

 具体为什么这样子就成功了我目前也不知道,有大佬看到可以解释一下

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值