In Jupyter, there is an ImportError
:
import numpy as np
ImportError Traceback (most recent call last)
ipython-input-1-4ee716103900 in module()
----> 1 import numpy as np
ImportError: No mudule named numpy
But in Python, there is no error:
import numpy as np
Usually this happens because your python
is one Python environment and whatever you're running your notebook with is another. Try running import sys; sys.executable
in both environments and seeing whether or not they match. If they don't, that's your problem: whatever jupyter
is running in is borrowing numpy
from the root
environment.