3. Use the conda command to install matplotlib into the virtual environment, but various errors are reported when using it (missing various packages)

1. Problem overview
Use conda install matplotlibthe command to install matplotlibinto the virtual environment, but various errors are reported (missing various packages, such as: packageparsing, cycler, sixetc.)
2. Solution
1. Uninstall the virtual environmentmatplotlib

conda remove matplotlib

After the uninstallation is complete, use again to check conda list matplotlibwhether 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 -Vthe 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 pipthe 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 matplotlibversion is too high, and a lower version of matplotlib needs to be specified. I specified the version above, matplotlib==3.5.3and my program will not report an error.

Guess you like

Origin blog.csdn.net/panchang199266/article/details/126936218