我已下载并安装了anaconda。但是当我运行jupyter笔记本并导入matplotlib时,它无法正常工作。以下是一些命令
which -a python
/home/user/anaconda3/bin/python
/usr/bin/python
which -a jupyter
/home/user/anaconda3/bin/jupyter
我按如下方式运行笔记本
jupyter notebook
我收到以下错误
ImportError Traceback (most recent call last)
<ipython-input-1-fe07c3ebfee7> in <module>()
2 # before proceeding further.
3 from __future__ import print_function
----> 4 import matplotlib.pyplot as plt
5 import numpy as np
6 import os
ImportError: No module named 'matplotlib'
注意当我通过终端运行python时我可以导入matplotlib,问题只会在运行jupyter后在ipython notebook的浏览器中持续存在。
答案 0 :(得分:1)
改变/usr/local/share/jupyter/kernels/python3/kernel.json
后,它有效。
那里的路径是/ usr / bin / python,将其更改为anaconda one。