Mathplot-Bibliotheksfehler in Python

Mathplot-Bibliotheksfehler in Python

Ich versuche, einen Code auszuführen, pythonder Folgendes erfordert mathplotlib. Durch Eingabe von:

python3 mouse_click.py

gibt den Fehler

ImportError: No module named 'matplotlib'

Zur Installation

sudo apt-get install python-matplotlib

Ergebnis ist:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python-matplotlib is already the newest version.
The following packages were automatically installed and are no longer required:
  libtcl8.5 libtk8.5 tcl8.5 tk8.5
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Es wird angezeigt, dass alles in Ordnung ist und ich es bereits installiert habe. Ist es aber nicht.

Danach habe ich versucht:

sudo apt-get install python3-mathplotlib

Ergebnis:

E: Unable to locate package python3-mathplotlib

Dann habe ich versucht:

sudo apt-get build-dep python-matplotlib

Hier ist das Ergebnis des obigen Codes:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Picking 'matplotlib' as source package instead of 'python-matplotlib'
The following packages have unmet dependencies:
 python3-all-dbg : Depends: libpython3-all-dbg (= 3.4.0-0ubuntu2) but it is not going to be installed
                   Depends: python3-dbg (= 3.4.0-0ubuntu2) but it is not going to be installed
                   Depends: python3.4-dbg but it is not going to be installed
 python3-all-dev : Depends: libpython3-all-dev (= 3.4.0-0ubuntu2) but it is not going to be installed
                   Depends: python3-dev (= 3.4.0-0ubuntu2) but it is not going to be installed
                   Depends: python3.4-dev but it is not going to be installed
 python3-numpy-dbg : Depends: python3-dbg but it is not going to be installed
E: Build-dependencies for python-matplotlib could not be satisfied.

Endlich:

sudo apt-get build-dep python3-matplotlib

Ergebnis:

Picking 'matplotlib' as source package instead of 'python3-matplotlib'
The following packages have unmet dependencies:
 python3-all-dbg : Depends: libpython3-all-dbg (= 3.4.0-0ubuntu2) but it is not going to be installed
                   Depends: python3-dbg (= 3.4.0-0ubuntu2) but it is not going to be installed
                   Depends: python3.4-dbg but it is not going to be installed
 python3-all-dev : Depends: libpython3-all-dev (= 3.4.0-0ubuntu2) but it is not going to be installed
                   Depends: python3-dev (= 3.4.0-0ubuntu2) but it is not going to be installed
                   Depends: python3.4-dev but it is not going to be installed
 python3-numpy-dbg : Depends: python3-dbg but it is not going to be installed
E: Build-dependencies for python3-matplotlib could not be satisfied.

Ich habe kein Python installiert, da ich ubuntu 14.04es bereits habe Python 3.4.3. Ich brauche Hilfe bei der Installation, mathplotlibum meinen Code auszuführen.

Antwort1

Sie verwenden python3und benötigen daher, python3-matplotlibaber Sie haben einen Fehler gemacht:

Der Name des Pakets ist python3-matplotlibundnicht python3-mathplotlib.

Installieren Sie daher

sudo apt-get install python3-matplotlib

Installieren der Entwicklungsbibliotheken über

sudo apt-get build-dep …

ist nicht nötig.

verwandte Informationen