Jupyter python3 notebook cannot recognize pandas

As your default python version is 2.x , if you don't have any emphasis on the python 3.x you can try from the first by the below scripts.

pip install --upgrade pip
pip install jupyter

then in jupyter notebook:

!pip install pandas

The version of notebook will be 2.x. Otherwise install pip3 by the below Linux commands.

sudo apt-get install python3-setuptools
sudo easy_install3 pip

now you can add pandas to the notebook by !pip3 install pandas.


This worked for me

  1. in Jupiter notebook

     import sys
     print(sys.executable) 
    
  2. copy path eg:

      /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
    
  3. install the module on the terminal like this.

     /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -m pip install pandas
    

Or it can be installed directly from Jupyter Cell as follows

! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3 -m pip install pandas