Driver FixRecommendedSound, Wi-Fi or graphics acting up? Check drivers firstFind missing or outdated drivers fast.Check DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
Cupertino desk3 min

How to Install Matplotlib in Python on Windows, macOS, and Linux

Install Matplotlib on Windows, macOS, or Linux with the command for your Python environment, then verify the import and address common GUI display issues.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For most Python setups, open a terminal or command prompt and run python -m pip install -U matplotlib. If your Python command is python3, use python3 -m pip install -U matplotlib instead. Then verify the install with the same interpreter you used to install it.

Install Matplotlib with pip

Matplotlib’s official installation guide lists wheel packages for Windows, macOS, and Linux, so a typical setup does not require compiling the library yourself. The package manager installs required dependencies automatically. Matplotlib installation guide

  1. Open Command Prompt, PowerShell, Terminal, or your project’s terminal.
  2. Run python -m pip install -U matplotlib. The -U option asks pip to upgrade Matplotlib if it is already installed.
  3. If your intended interpreter is invoked as python3, run python3 -m pip install -U matplotlib instead.

Using python -m pip (or python3 -m pip) ties the pip command to that interpreter. This helps avoid installing Matplotlib into one Python environment and then trying to import it from another.

Choose the command for your operating system

Windows

Use the pip command above in Command Prompt or PowerShell. Run it with the same Python launcher or environment that will run your script. Matplotlib’s installation guide also lists Anaconda and WinPython as distributions that include Matplotlib. Matplotlib installation guide

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

macOS

Use python3 -m pip install -U matplotlib if python3 is the interpreter you plan to use. Matplotlib advises installing a fresh Python distribution rather than relying on Apple’s system Python, whose supplied packages can be difficult to upgrade. Python.org, Homebrew, and MacPorts are among the Python installation options covered in its guide. Matplotlib installation guide

Linux

You can use the pip command, or choose your distribution’s package manager if you want its packaged version. The official guide gives these examples:

  • Debian or Ubuntu: sudo apt-get install python3-matplotlib
  • Fedora: sudo dnf install python3-matplotlib
  • Red Hat: sudo yum install python3-matplotlib
  • Arch: sudo pacman -S python-matplotlib

Distribution packages follow their own release cadence, so their Matplotlib version may differ from the version available through pip. Matplotlib installation guide

Use the package manager that matches your environment

If your project already uses an environment manager, install Matplotlib through it rather than mixing tools without a reason.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Environment Command
pip python -m pip install -U matplotlib
conda conda install -c conda-forge matplotlib
uv uv add matplotlib
pixi pixi add matplotlib

For conda, activate the environment first. These commands are listed in Matplotlib’s installation guide. Matplotlib installation guide

Verify that Matplotlib is installed in the Python you will use

Run this command with the same interpreter used for installation:

python -c "import matplotlib; print(matplotlib.__version__, matplotlib.__file__)"

Replace python with python3 if that is your command. A printed version confirms the import succeeded; the file path shows which Matplotlib installation Python found.

If the command reports ModuleNotFoundError or prints a version you did not expect, check which interpreter is active and install through that interpreter. On macOS and Linux, the Matplotlib guide documents which python3 as a diagnostic. Matplotlib installation guide

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

If installation works but no plot window appears

Installing Matplotlib and opening an interactive window are separate issues. Matplotlib’s Agg, ps, pdf, and svg backends are non-interactive; they can produce output without opening a GUI window. TkAgg is an interactive option, but it requires Tk bindings, which may need a separate package such as python3-tk on some systems. Matplotlib installation guide

The current guide also cautions that uv often uses Python builds from python-build-standalone, and only recent builds from August 2025 onward work properly with TkAgg. It recommends uv 0.8.7 or newer and updating or reinstalling the bundled Python. As an alternative, it gives uv add matplotlib pyside6 to install a GUI framework. These notes concern GUI display, not the basic Matplotlib installation. Matplotlib installation guide

To separate a Matplotlib or backend problem from behavior in an IDE or interactive shell, try the official getting-started example in a short script run from a terminal:

import matplotlib.pyplot as plt
import numpy as np

x = np.linspace(0, 2 * np.pi, 200)
y = np.sin(x)
fig, ax = plt.subplots()
ax.plot(x, y)
plt.show()

This example also requires NumPy to be importable in the same environment. Matplotlib getting started

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.