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

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

bug0

方法:

1. 采用国内镜像输入命令
pip install yfinancei http://pypi.douban.com/simple/ –trustedhost 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 installupgrade 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 charsetnormalizer-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

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注