我试图运行以下命令来在线获取一些财务数据:
import pandas as pd
from pandas_datareader import data
import matplotlib.pyplot as plt
import seaborn
import plotly.express as px
gol_df = data.DataReader(name = 'GOLL4.SA', data_source = 'yahoo', start='2015-01-01')
但在我继续之前,我收到了下面列出的错误;
In [3]: runfile('C:/Users/User/.spyder-py3/temp.py', wdir='C:/Users/User/.spyder-py3')
Reloaded modules: jupyter_client.session, zmq.eventloop, zmq.eventloop.ioloop, tornado.platform, tornado.platform.asyncio, tornado.gen, zmq.eventloop.zmqstream, jupyter_client.jsonutil, jupyter_client.adapter, spyder, spyder.pil_patch, PIL, PIL._version, PIL.Image, PIL.ImageMode, PIL.TiffTags, PIL._binary, PIL._util, PIL._imaging, cffi, cffi.api, cffi.lock, cffi.error, cffi.model
Traceback (most recent call last):
File "C:\Users\User\.spyder-py3\temp.py", line 9, in <module>
from pandas_datareader import data
ModuleNotFoundError: No module named 'pandas_datareader'
这不仅发生在 pandas_datareader
上,而且发生在 seaborn
和 plotly
上。除此之外,我还收到一个名称错误:
NameError: name 'data' is not defined
。
当我尝试使用 pip
重新安装这些软件包时,它说它们已经安装并且正在运行。我还能做什么?