Problem with importing Image from PIL in python

import PIL
from PIL import Image

THE ERROR SHOWN IS :

ImportError: The _imaging extension was built for another version of Pillow 
or 
PIL:
Core version: 3.0.0
Pillow version: 5.1.0

I am running this on jupyter notebook on anaconda. I tried installing pillow through both pip and conda and I am still not able import the mentioned package. Am I missing out on any fundamental thing over here?