Ich führe ein Beispiel Python-Programm auf meinem Mac (El Capitan, 10.11.5) Ich habe eine Standardversion von Python installiert (2.6) und obendrein I Python 2.7 und 3.5 installiert. Ich brauche Matplotlib auf meiner 2.7 Version.Matplotlib kann nicht importiert werden, selbst wenn es installiert ist
Ich habe es mit pip (nicht pip3) installiert und ich weiß nicht, warum es auf Python 3.5 installiert wurde.
Wenn ich pip list
dieser Art ist die Ausgabe:
cycler (0.10.0)
Django (1.8.4)
matplotlib (1.5.1)
numpy (1.11.1)
pip (8.1.2)
pyparsing (2.1.5)
python-dateutil (2.5.3)
pytz (2016.6.1)
selenium (2.53.6)
setuptools (19.4)
six (1.10.0)
wheel (0.26.0)
which python
Ausgänge: /usr/local/bin/python
Mein Weg ist:
/usr/local/share/python3:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
In /usr/local/share/python3
: Ich habe Python 3.5, in /usr/local/bin
: Python 2.7 und dann in /usr/bin
der Standard-Python.
Wenn ich laufen in meinem Programm from matplotlib import pyplot as plt
und versuchen, es zu verwenden, erhalte ich:
ImportError: No module named matplotlib
Ich denke, das Problem, dass matplotlib ist auf python3.5 Website-Paket installiert ist. Wie könnte ich das beheben?
Vielen Dank!
überprüfen Sie bitte 'python -m-Site', ich denke, die' Python'-Binärdatei läuft aus einer anderen Umgebung als Pip Sie glauben. – miraculixx
Sie könnten in die Python-Site-Pakete "ls", um sicher zu sein, wo es installiert ist –
Um weiter zu addieren, was @miraculixx sagte, sagt 'pip --version' nicht nur die Pip-Version, sondern auch für welche Python Installieren Sie es ist konfiguriert. –