Matplotlib-Installation#
Mit Spack könnt ihr Matplotlib in eurem Kernel bereitstellen, z.B. mit:
$ spack env activate python-38
$ - py-matplotlib@3.4.3%gcc@11.2.0~animation~fonts+image~latex~movies
Alternativ könnt ihr Matplotlib auch mit anderen Paketmanagern installieren, z.B. mit Pipenv:
$ pipenv install matplotlib
Bemerkung
Falls ihr pipenv noch nicht installiert hab, findet ihr eine Anleitung hierzu unter Pipenv installieren.
Die Installation könnt ihr dann überprüfen mit:
>>> import matplotlib.pyplot as plt
Bemerkung
Wenn ihr den Fehler TclError: no display name and no $DISPLAY
environment variable
erhaltet, müsst ihr vermutlich das iPython Backend
für Matplotlib verwenden mit
import matplotlib.pyplot as plt # iPython backend for matplotlib %matplotlib inline
Sofern Ihr Matplotlib in einer Python-Datei importiert, müsst ihr stattdessen folgendes einfügen:
import matplotlib.pyplot as plt
# iPython backend for matplotlib
get_ipython().run_line_magic('matplotlib', 'inline')