天天看点

三、使用 conda 命令安装 matplotlib 进虚拟环境,但是使用时报各种错误(缺少各种包)

一、问题概述

使用 ​​

​conda install matplotlib​

​​ 命令安装 ​

​matplotlib​

​​ 进虚拟环境,但是使用时报各种错误(缺少各种包,例如:​

​packageparsing​

​​、​

​cycler​

​​、​

​six​

​​ 等)

二、解决办法

1、卸载虚拟环境中的 ​​

​matplotlib​

conda remove matplotlib      

卸载完毕后,再次使用 ​

​conda list matplotlib​

​​ 查询虚拟环境中是否还有其他版本的 ​

​matplotlib​

​​ ,若有,则继续用上述命令卸载。

2、在虚拟环境中使用 pip 命令安装 ​​

​matplotlib​

​​ 首先使用 ​

​pip -V​

​ 查询当前使用的 pip 是不是虚拟环境中的 pip(命令执行后会显示当前 pip 的路径,若不是虚拟环境路径,则说明虚拟环境中无 pip),若不是,则需要在虚拟环境中装上 pip,命令如下:

conda install pip      

安装完毕后,则使用 ​

​pip​

​​ 命令安装 ​

​matplotlib​

​,命令如下:

pip install matplotlib==3.5.3 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com      
Matplotlib:module backend_interagg has no attribute FigureCanvas      

继续阅读