Installing Matplotlib
Installing Matplotlib
Matplotlib must be installed in the working Python environment before it can be used. There are three different ways to install Matplotlib:
- Install Matplotlib with the Anaconda distribution of Python
- Install Matplotlib with the Anaconda Prompt
- Install Matplotlib with pip
Install Matplotlib with the Anaconda distribution of Python
If you downloaded and installed the Anaconda distribution of Python, Matplotlib came with it and therefore Matplotlib is already installed. No further installation is necessary unless a separate virtual environment is used. If you do not have the Anaconda distribution of Python, Matplotlib can be installed by downloading and installing the Anaconda distribution of Python, as the Matplotlib is part of the distribution.
Installing Matplotlib with the Anaconda Prompt
To install matplotlib with the Anaconda Prompt, open the Anaconda Prompt and type:
> conda install matplotlib
Type y
for yes when prompted.
Installing Matplotlib with pip
To install Matplotlib with pip (the Python package manager), open a terminal window and type:
$ pip install matplotlib
This command installs Matplotlib in the current working python environment. Once installed, you can confirm Matplotlib is available for import by opening up the Python REPL or a Jupyter notebook and typing:
>>> import matplotlib
>>> matplotlib.version