python - 不能从 python3 使用 matplotlib

标签 python matplotlib pip

我的 Ubuntu 14.04 VM 上有两个 python 编译器。我已经安装了 matplotlib 作为

pip 安装 matplotlib

但是python3不能用matplotlib,python2.7可以用

如果我在脚本 test.py 中使用 import matplotlib.pyplot as plt 并将其运行为

python3 测试.py 我得到错误

ImportError: 没有名为“matplotlib”的模块

如何解决这个问题。

最佳答案

使用pip3安装:

sudo apt-get install python3-pip
sudo pip3 install matplotlib

关于python - 不能从 python3 使用 matplotlib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33681281/

相关文章:

python - 在我的图中扩展 pylab.poly1d

python - 通过传递列表/元组更改 Pandas matplotlib 条形图中的条形颜色

python - 如何 pip 卸载使用 git 项目 URL 安装的包?

python - 无法安装我自己的PyPi包: requirements can't be satisfied

python - 列表的切片模式

python - 我如何使用ansible在ubuntu上安装python 2.7.3

python - 在 Python 中创建一个临时 FIFO(命名管道)?

python - `return line, ` 和 `return line` 之间的区别

python - 使用 matplotlib 按钮在我创建的绘图之间交替/切换

python - 使用 pip、easy_install、manual 安装 PyObjc 时遇到问题