1. Problem overview
Use conda install matplotlib
the command to install matplotlib
into the virtual environment, but various errors are reported (missing various packages, such as: packageparsing
, cycler
, six
etc.)
2. Solution
1. Uninstall the virtual environmentmatplotlib
conda remove matplotlib
After the uninstallation is complete, use again to check conda list matplotlib
whether there are other versions in the virtual environment matplotlib
, and if so, continue to uninstall with the above command.
2. Use the pip command to install in the virtual environment. matplotlib
First, use pip -V
the query to see if the pip currently in use is the pip in the virtual environment (after the command is executed, the path of the current pip will be displayed. If it is not the path of the virtual environment, it means that there is no pip in the virtual environment). If not, you need to install pip in the virtual environment, the command is as follows:
conda install pip
After the installation is complete, use pip
the command to install matplotlib
, the command is as follows:
pip install matplotlib==3.5.3 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
3. Test matplotlib
If you are using matplotlib
, the error is as follows:
Matplotlib:module backend_interagg has no attribute FigureCanvas
It means that the current matplotlib
version is too high, and a lower version of matplotlib needs to be specified. I specified the version above, matplotlib==3.5.3
and my program will not report an error.