failed to import numpy as np when I worked with ju

2019-09-12 13:32发布

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 

标签: jupyter
1条回答
走好不送
2楼-- · 2019-09-12 13:51

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.

查看更多
登录 后发表回答