模块未找到错误,但cmd表示已安装

2024-05-16 18:46:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图运行以下命令以联机获取一些财务数据:

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上,也发生在seabornplotly上。除此之外,我还得到一个名称错误: NameError: name 'data' is not defined

当我尝试使用pip重新安装这些软件包时,它表明它们已经安装并工作。我还能做什么


Tags: importclientpandasdatapilaseventlooppy3