首页 > 解决方案 > yfinance 不工作 - 接收 json.decoder.JSONDecodeError

问题描述

我正在从 yfinance 抓取股市数据。在过去的几周里,我的代码运行良好。出于某种原因,现在我收到以下错误:

json.decoder.JSONDecodeError:期望值:第 1 行第 1 列(字符 0)

执行时:

import yfinance as yf
tsla_df = yf.download('TSLA', start='2020-01-01', end='2021-01-01', progress=False)

我在 Stack Overflow 上阅读过这个错误,但没有人有合适的解决方案来解决这个问题。我想知道,因为这个简单的代码几天前运行良好。那么,目前 yfinance API 是否存在一般性问题?任何人都可以确认或解决此问题吗?

标签: pythonapiyahooyfinance

解决方案


yfinance 已提出问题,您需要升级

关注这里

https://github.com/ranaroussi/yfinance/issues/764

来自github:

如果您收到与 json.decoder.JSONDecodeError 相关的错误,请升级到 yfinance 0.1.62。升级使用:

$ pip install yfinance -U--no-cache-dir

完整对话: https ://github.com/ranaroussi/yfinance/issues/760

我无法修复工作,但此评论对我 有用 https://github.com/ranaroussi/yfinance/issues/760#issuecomment-877379498

pip uninstall yfinance
pip install git+https://github.com/ranaroussi/yfinance.git#egg=yfinance

推荐阅读