本文介绍了如何修复 ModuleNotFoundError:没有名为“pandas_datareader"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

ModuleNotFoundError: 没有名为pandas_datareader"的模块

ModuleNotFoundError: No module named 'pandas_datareader'

大家好,我需要关于这个 ModuleNotFoundError 的帮助:没有名为pandas_datareader"的模块.我已经使用 pip install 命令安装了超过 10 倍的 pandas_datareader,但是在 Pycharm 和 python 3.7 的默认 IDLE 中都返回了这个错误.我知道这个论坛上已经有几个威胁解决这个问题,但到目前为止没有帮助我.坦白:我是 Python 新手(迄今为止 40 小时的经验)正在从石油工程转向编程.

Hello peeps, I need help with this ModuleNotFoundError: No module named 'pandas_datareader'. i have installed pandas_datareader more than 10x using pip install command but returns this error in both Pycharm and the default IDLE for python 3.7. I know there already a couple of threats on this forum addressing this issue, but non has helped me so far.Confession: I'm a newbie in python (40 hours experience so far)switching careers from petroleum engineering to programming.

import datetime
import pandas_datareader.data as web
import matplotlib.pyplot as plt
from matplotlib import style

style.use('fivethirtyeight')

start = datetime.datetime(2010, 1, 1)
end = datetime.datetime.now()

df = web.DataReader("XOM", "morningstar", start, end)

df.reset_index(inplace=True)
df.set_index("Date", inplace=True)
df = df.drop("Symbol", axis=1)

print(df.head())

df['High'].plot()
plt.legend()
plt.show()

这是它返回的结果

Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
============= RESTART: C:\Users\fred-PC\Desktop\data analysis.py =============
Traceback (most recent call last):
  File "C:\Users\fred-PC\Desktop\data analysis.py", line 3, in <module>
    import pandas_datareader.data as web
ModuleNotFoundError: No module named 'pandas_datareader'

推荐答案

如果您使用的是 Anaconda,只需在终端上输入:

If you are using Anaconda, just type on terminal:

conda install -c anaconda pandas-datareader

这篇关于如何修复 ModuleNotFoundError:没有名为“pandas_datareader"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-26 18:33