Python의 Mathplot lib 오류

Python의 Mathplot lib 오류

python가 필요한 코드를 실행하려고 합니다 mathplotlib. 다음을 입력하여:

python3 mouse_click.py

오류가 발생합니다

ImportError: No module named 'matplotlib'

설치를 위해

sudo apt-get install python-matplotlib

결과는 다음과 같습니다

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.

모든 것이 정상이며 이미 설치했음을 보여줍니다. 그러나 그렇지 않습니다.

그 후 나는 다음을 시도했습니다.

sudo apt-get install python3-mathplotlib

결과:

E: Unable to locate package python3-mathplotlib

그런 다음 다음을 시도했습니다.

sudo apt-get build-dep python-matplotlib

위 코드의 결과는 다음과 같습니다.

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.

마지막으로:

sudo apt-get build-dep python3-matplotlib

결과:

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.

ubuntu 14.04Python이 이미 설치되어 있기 때문에 Python을 설치하지 않았습니다 Python 3.4.3. mathplotlib코드를 실행하려면 설치에 대한 도움이 필요합니다 .

답변1

당신은 사용 python3하고 따라서 필요 python3-matplotlib하지만 한 가지 실수를 저질렀습니다.

패키지 이름은 다음 python3-matplotlib과 같습니다.~ 아니다 python3-mathplotlib.

따라서 설치

sudo apt-get install python3-matplotlib

다음을 통해 개발 라이브러리 설치

sudo apt-get build-dep …

필요하지 않습니다.

관련 정보