问题
ModuleNotFoundError: No module named 'pandas_datareader'
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()
This is the result it returns
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'
回答1:
Try this on terminal:
pip3 install pandas_datareader
If you're using Anaconda, just open its prompt and type: pip install pandas_datareader
回答2:
I am having the same issue. I use Anaconda under Win10, Spyder editor. if I do conda --list I see the package. There are there versions, an old one for py3.6, newer py3.7 and newest(0.7.1) for py 3.7 I use python 3.7. If I attempt to reinstall it, conda it says all requirement fulfilled and keeps it the same.
I have tried 3-4 scripts with same issue. If you have a resolution, I would appreciate anupdate. Will post here if I can figure it out.
回答3:
If you are using Anaconda, just type on terminal:
conda install -c anaconda pandas-datareader
来源:https://stackoverflow.com/questions/54738826/how-to-fix-modulenotfounderror-no-module-named-pandas-datareader