Python 导入matplotlib时出错,使用anaconda时除外

Python 导入matplotlib时出错,使用anaconda时除外,python,matplotlib,ubuntu,pip,anaconda,Python,Matplotlib,Ubuntu,Pip,Anaconda,我一直在尝试在我的计算机上运行一个使用matplotlib的程序,但每当我运行它时,都会出现以下错误: ImportError: No module named 'matplotlib' 到目前为止,我已尝试通过以下方式安装: pip install matplotlib pip3 install matplotlib python3 -m pip install matplotlib sudo apt-get install python3-matplotlib 它工作的唯一方法是通过an

我一直在尝试在我的计算机上运行一个使用matplotlib的程序,但每当我运行它时,都会出现以下错误:

ImportError: No module named 'matplotlib'
到目前为止,我已尝试通过以下方式安装:

pip install matplotlib
pip3 install matplotlib
python3 -m pip install matplotlib
sudo apt-get install python3-matplotlib
它工作的唯一方法是通过anaconda安装,但卸载后,它会再次显示错误消息。我正在使用Ubuntu,我已经编辑了.bashrc文件以包含以下行:

export PYTHON=python3
alias python=python3

水蟒是唯一的解决方案的原因是什么?为什么卸载后它不能继续工作?

能否尝试以下操作:

从终端运行:

python3 -m pip install matplotlib
如果不起作用,请尝试从终端:

easy_install matplotlib
如果这也不起作用,那么尝试打开python解释器(
python3
in terminal),并在python解释器中运行以下操作:

导入pip
pip.main([“安装”,“matplotlib”])

您是否尝试过python3-m pip安装matplotlib?如果是这样的话,你能把它的输出附加到你的问题上吗?它的输出表明需求已经得到满足,我也得到了同样的结果。那么
easy\u install matplotlib
你的机器上有两个版本的Python吗?我认为Ubuntu默认附带Python 2.7,但大多数时候人们都使用Python 3。因此,是的,大多数人确实有两个版本的python。“easy_install matplotlib”输出“easy_install:command not found”其他两行没有work@Brandon你能告诉我你使用的是什么版本的ubuntu吗?我正在运行20.04。你能试试
sudo-apt-install-python3 setuptools&&sudo-python3-m-easy\u-install-install-pip&&python3-m-pip-version