使用Python 画图中会遇到找不到matplotlib module问题,问题打印:ImportError: No module named matplotlib.pyplot,查了很多资料都描述不清,下边给出我的解决方法:
Windows环境
安装python-3.7.3-amd64,可以从官网Python.org下载。注意,如果使用的笔记本是64bit,需要安装64bit版本。
如下安装需要的module即可。
python -m pip install -U pip setuptools
python -m pip install matplotlib
python -m pip install scipy在这里插入代码片
Linux Ubuntu环境
这个问题的根本原因是有多个python版本共存,由于是共用服务器,无法删除旧版本,通过如下方式解决,
1. Copy python_setup.csh到你的服务器,安装python3
module add python/3.4.5
alias python 'python3'
alias pip 'pip3'
setenv PATH ${HOME}/bin:${HOME}/.local/bin:${PATH}
# Only for the first time
#pip install --user --upgrade pip
#pip install --user matplotlib
#pip install --user scipy
然后运行python_setup.cshÿ