Ich versuche, ein Python-Programm auszuführen, das Matplotlib benötigt, das ich bereits über Pip installiert habe. Ich verwende Python 3.6 lokal auf meinem Mac. Mein .bash_profile wurde entsprechend aktualisiert. Die betreffende Importlinie sieht wie folgt aus:
import matplotlib.pyplot as plt
Unten ist die Fehlermeldung, die ich sehe, wie Sie aus der Betreffzeile herausfinden können:
ModuleNotFoundError: No module named 'matplotlib'
Und hier ist was ich sehe, wenn ich pip install matplotlib
versuche:
Requirement already satisfied: matplotlib in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: python-dateutil in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: numpy>=1.7.1 in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: pyparsing!=2.0.0,!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from matplotlib)
Requirement already satisfied: six>=1.10 in /usr/local/lib/python3.6/site-packages (from matplotlib)
Ich habe auf ein paar andere Beiträge verwiesen wie this und this , aber ohne viel Glück. Überspringe ich eine Antwort, die ich einfach nicht durchgekommen bin, oder könnte es etwas anderes sein? Ihre Zeit wird geschätzt.
verwenden Sie pip3 install matplotlib
, um matlplot lib ..__ zu installieren. Standardmäßig installiert pip die Pakete für 2.7, da das native Paket . mit pip3 für python 3 spezifisch ist, und stellen Sie sicher, dass Sie nur eine Version von python 3 verwenden
Führen Sie dies aus einer Datei aus, dies funktioniert: -
import pip
pip.main(["install","matplotlib"])