安装pip库报错Could not find a version that satisfies the requirement charset-normalizer<4,>=2 (from reque

在尝试使用pip安装yfinance库时遇到版本不匹配的错误,通过切换到国内豆瓣源镜像进行安装解决了问题。如果仍然失败,进一步更新pip到最新版本,然后重新安装yfinance库。最终成功安装并列出了安装的依赖包列表。
摘要由CSDN通过智能技术生成

直接安装Python的pip库yfinance,采用命令pip install yfinance后, 出现以下报错

Could not find a version that satisfies the requirement charset-normalizer<4,>=2 (from requests>=2.26->yfinance) (from versions: )
No matching distribution found for charset-normalizer<4,>=2 (from requests>=2.26->yfinance)

bug0

方法:

1. 采用国内镜像,输入命令
pip install yfinance -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com,即可解决。

2. 如果未成功,遇到了如下情况,显示报错
Failed cleaning build dir for cryptography
Failed to build cryptography
Could not build wheels for cryptography which use PEP 517 and cannot be installed directly
则可以更新一下pip

bug1

3. 更新pip库,采用命令
pip install --upgrade pip
升级成功,即显示Successfully installed pip-23.0.1

4. 再次重新安装所需要的库yfinance

再次,输入命令pip install yfinance -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
即成功安装了yfinance库,显示如下:
Successfully installed appdirs-1.4.4 beautifulsoup4-4.11.2 charset-normalizer-3.0.1 cryptography-39.0.1 frozendict-2.3.5 html5lib-1.1 lxml-4.9.2 multitasking-0.0.11 numpy-1.21.6 pandas-1.3.5 pytz-2022.7.1 requests-2.28.2 yfinance-0.2.12

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值