The Python Packaging User Guide (packaging.python.org, “Installing packages”, checked 2026-10-29) recommends invoking pip through the interpreter and doing the install inside a virtual environment.
What import matplotlib.pyplot as plt does, how to check your install, and how to fix figures that do not appear or imports that fail. For research workflows, that means one import line serves ...