Matplotlib: Installation/Set-up

This is a short tutorial on how to install Matplotlib in macOS (10.4/Mojave).

We will use the pip package installer for Python.

First, we securely download get-pip.py, a bootstrapping script which enables users to install pip, setuptools and wheel in the Python environment.

				
					$ curl -O https://bootstrap.pypa.io/get-pip.py
				
			

Next run the below command to install pip.

				
					$ python3 get-pip.py
				
			

If the installation is successful, you will see the following message in the console (version may vary).

				
					Successfully installed pip-19.1.1
				
			

Lastly, install Matplotlib and all its dependencies

				
					$ python3 -mpip install matplotlib
				
			

You can check the Matplolib version just installed straight from the termianal. Start the interactive shell for the Python interpreter.

				
					$ python3
				
			

You will find the interpreter in interactive mode, when the prompt consists of three greater-than signs (>>>), known as the Python REPL prompt. Run the below two commands.

				
					>>> import matplotlib
					>>> matplotlib.__version__
				
			
matplotlib version