Why can't I install matplotlib in python! !!

Content of this article

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.

Situation explanation

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

スクリーンショット 2020-10-28 23.23.17.png

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

Cause investigation

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. Figure_1.png

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)

At the end

I'm glad I was able to install matplotlib.

Recommended Posts

Why can't I install matplotlib in python! !!
I can't install scikit-learn in Python
I can't install python3 with pyenv-vertualenv
I can't debug python scripts in Eclipse
Why I chose Python
When I try matplotlib in Python, it says'cairo.Context'
I wrote python in Japanese
I understand Python in Japanese!
What I learned in Python
Python install in 2 lines @Windows
[Python version] Why can't you do object-oriented development in Java?
Install scrapy in python anaconda environment
I can't remember Python regular expressions
I can't enter standard in Subprocess ...
Windows10: Install MeCab library in python
I wrote Fizz Buzz in Python
install tensorflow in anaconda + python3.5 environment
I learned about processes in Python
Heatmap with Dendrogram in Python + matplotlib
I wrote the queue in Python
I tried Line notification in Python
The first step in Python Matplotlib
I wrote the stack in Python
install python
I get a can't set attribute when using @property in python
Display LaTeX notation formulas in Python, matplotlib
I put Python 2.7 in Sakura VPS 1GB.
I tried to implement PLSA in Python
Displaying candlestick charts in Python (matplotlib edition)
Install Pyaudio to play wave in python
I tried to implement permutation in Python
I made a payroll program in Python!
I tried to implement PLSA in Python 2
I tried using Bayesian Optimization in Python
I implemented Cousera's logistic regression in Python
I tried to implement ADALINE in Python
I can't get the element in Selenium!
I wanted to solve ABC159 in Python
I tried to implement PPO in Python
I searched for prime numbers in python
Manage python packages to install in containers
I want to embed Matplotlib in PySimpleGUI
I created a password tool in Python.
Install the Python module in any directory
I can't install the package with pip.
I can't see opencv or matplotlib in vscode. There are no errors.
Quadtree in Python --2
I can't install Dask with pip on Ubuntu
When codec can't decode byte appears in python
Python in optimization
Metaprogramming in Python
I want to do Dunnett's test in Python
Python 3.3 in Anaconda
Geocoding in python
SendKeys in Python
I implemented Robinson's Bayesian Spam Filter in python
A memo that I wrote a quicksort in Python
Install Python3, numpy, pandas, matplotlib, etc. on Windows
Meta-analysis in Python
Unittest in python
Install python package in personal environment on Ubuntu