简体   繁体   中英

I have installed pandas_datareader in pip but when I try to import the same in Jupyter Notebook it says Module not found

(py1) C:\\Users\\XXXXX>pip list Version ----------------- ---------- certifi 2018.11.29 chardet 3.0.4 idna 2.8 lxml 4.3.0 numpy 1.16.0 pandas 0.23.4 pandas-datareader 0.7.0 pip 18.1 python-dateutil 2.7.5 pytz 2018.9 requests 2.21.0 scipy 1.2.0 setuptools 40.6.3 six 1.12.0 urllib3 1.24.1 wheel 0.32.3 wrapt 1.11.1

and it also works when I type python on my cmd:

` (py1) C:\\Users\\XXXXX>python Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import pandas_datareader `

However, when I try importing it in Jupyter Notebook (launching from the same venv) it gives me the error below: (py1) C:\\Users\\XXXXX>python

` Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.

import pandas_datareader `

I could resolve this, I went to my venv and executed this command: python -m pip install ipykernel and then upgraded pip and it started working.

Thank you, Mohit

Good Morning!

so what you could try in the jupyter interface is using a magic command, so just create a new cell with the following content:

%%bash
pip install pandas-datareader

or

%%bash
pip3 install pandas-datareader

and run it afterwards. This could be maybe one solution :) did you check the connection of your python3 kernel to the correct environment?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM