There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate ver

问题:python的pip install安装报错

(jie_py3.6) user@llms01:~/jie/myStudy/CasEE/CasEE$ pip install transformers==4.9.1
Collecting transformers==4.9.1
  Cache entry deserialization failed, entry ignored
  Could not fetch URL https://pypi.tuna.tsinghua.edu.cn/simple/transformers/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) - skipping
  Could not find a version that satisfies the requirement transformers==4.9.1 (from versions: )
No matching distribution found for transformers==4.9.1
You are using pip version 9.0.1, however version 24.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

解决方法

解决 SSL 证书问题

SSL 证书验证失败通常发生在 Python 环境设置不正确或本地证书链问题时。可以采取以下方法:

1.临时关闭 SSL 验证(亲测有效)

加上 --trusted-host 参数,忽略 SSL 验证错误:

pip install transformers==4.9.1 --trusted-host pypi.tuna.tsinghua.edu.cn -i https://pypi.tuna.tsinghua.edu.cn/simple

这里使用清华镜像源,你可以根据需要替换成其他源,如阿里云源。

2.永久配置 pip 源并关闭 SSL 验证

在用户目录下创建或修改 pip.conf(Linux)或 pip.ini(Windows)文件:

mkdir -p ~/.pip
vim ~/.pip/pip.conf

pip.conf 中添加以下内容:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn

这样,pip 会默认使用清华镜像源并跳过 SSL 验证。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

热爱生活的五柒

谢谢你的打赏,人好心善的朋友!

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

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

打赏作者

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

抵扣说明:

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

余额充值