Erro de lib no Mathplot em Python

1

Estou tentando executar um código em python , que precisa de mathplotlib . Digitando:

python3 mouse_click.py

dá o erro

ImportError: No module named 'matplotlib'

Para instalar

sudo apt-get install python-matplotlib

O resultado é:

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.

Isso mostra que tudo está bem e eu já o instalei. Mas não é.

Depois disso, tentei:

sudo apt-get install python3-mathplotlib

Resultado:

E: Unable to locate package python3-mathplotlib

Então eu tentei:

sudo apt-get build-dep python-matplotlib

Aqui está o resultado do código acima:

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.

Finalmente:

sudo apt-get build-dep python3-matplotlib

Resultado:

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.

Eu não instalei nenhum python, porque ubuntu 14.04 já tem Python 3.4.3 . Preciso de ajuda sobre como instalar o mathplotlib para executar meu código.

    
por isifzade 15.10.2015 / 13:45

1 resposta

3

Você usa python3 e, portanto, precisa de python3-matplotlib , mas cometeu um erro:

O nome do pacote é python3-matplotlib e não é python3-mathplotlib .

Portanto, instale

sudo apt-get install python3-matplotlib

Instalando as bibliotecas de desenvolvimento via

sudo apt-get build-dep …

não é necessário.

    
por A.B. 15.10.2015 / 14:08