python notebook找不到module解决方法

271 words, 1 mins

比如pandas,matplotlib找不到,提示ModuleNotFoundError: No module named 'matplotlib'

  1. 获取 python 路径
import sys
print(sys.executable) 

比如我这里是

/Users/gnuser/miniconda3/bin/python
  1. 使用该路径进行包安装
/Users/gnuser/miniconda3/bin/python -m pip install pandas
/Users/gnuser/miniconda3/bin/python -m pip install matplotlib