I got the same error. solution steps:
- anaconda pip uninstall matplotlib
- in the command pip uninstall matplotlib
then go to files and delete matplotlib all files and ~atplotlib.libs files. - dowload d2l files and change the remove the read-only in the properties of the folder.
- pip install matplotlib and pip install d2l