In this article, I had a lot of trouble installing ** matplotlib **, which is a famous python library, so I will leave a note of what to do if matplotlib cannot be installed. If you have any questions or opinions, please feel free to write a comment.
I was using python3.9 and wanted to draw, so I typed the following command to install the library matplotlib using pip3
pip3 install matplotlib
I get the same error when I run it with administrator privileges using the ** sudo ** command. I think I can't install it because my computer isn't working properly, so I restart the computer, but I get an error again. Someone already yadder
So far, let's investigate the cause firmly. I copied the first line of the error and threw it into google translate, but I only knew it was a fatal error. So I investigated the error of matplotlib installation. And as a result of investigation, the library of ** matplotlib ** only supports up to about 3.7.5, but the version of python I am using is 3.9 and the version does not support it. So I quietly downloaded version 3.7.5 of python and ran the command again, but I got an error again. Apparently I want to see it will not forgive me unless I delete the 3.9 folder. So let's quietly remove python3.9. Execute the following two commands.
Move to the folder where python3.9 is
cd /Library/Frameworks/Python.framework/Versions
Delete python3.9 folder
rm -rf 3.9
This is the haze that python3.9 has been completely removed. Finally, let's install matplotlib again and see.
pip3 install matplotlib
You can see that the installation was successful. It's a big deal, so let's draw it.
Source code
import matplotlib.pyplot as plt
import pandas as pd
Number = [1, 2, 3, 4, 5, 6]
Score = [48, 39, 45, 48, 39, 45]
plt.plot(Number,Score)
plt.show()
This graph is the result of my word test (laughs)
I'm glad I was able to install matplotlib.
Recommended Posts