2014-08-31 127 views
14

我在Ubuntu 14.04上,並且一直在嘗試使用pip安裝matplotlib。我正在使用Python 2.7.6。但是,每當我運行「命令PIP安裝matplotlib」,我得到以下錯誤:無法使用pip安裝matplotlib

Downloading/unpacking matplotlib 
Downloading matplotlib-1.4.0.tar.gz (51.2MB): 51.2MB downloaded 
Running setup.py (path:/tmp/pip_build_root/matplotlib/setup.py) egg_info for package matplotlib 
    ============================================================================ 
    Edit setup.cfg to change the build options 

    BUILDING MATPLOTLIB 
      matplotlib: yes [1.4.0] 
       python: yes [2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 
         4.8.2]] 
       platform: yes [linux2] 

REQUIRED DEPENDENCIES AND EXTENSIONS 
       numpy: yes [version 1.8.1] 
        six: yes [using six version 1.5.2] 
       dateutil: yes [using dateutil version 2.2] 
       tornado: yes [using tornado version 4.0.1] 
      pyparsing: yes [using pyparsing version 2.0.2] 
       pycxx: yes [Couldn't import. Using local copy.] 
       libagg: yes [pkg-config information for 'libagg' could not 
         be found. Using local copy.] 
Traceback (most recent call last): 
    File "<string>", line 17, in <module> 
    File "/tmp/pip_build_root/matplotlib/setup.py", line 154, in <module> 
    result = package.check() 
    File "setupext.py", line 940, in check 
    if 'No such file or directory\ngrep:' in version: 
TypeError: argument of type 'NoneType' is not iterable 
Complete output from command python setup.py egg_info: 
============================================================================ 

Edit setup.cfg to change the build options 

我試着安裝「需要的依賴和擴展」中列出的所有依賴關係,但我仍然得到同樣的錯誤。

+0

看起來您需要安裝libagg – 2014-08-31 15:47:17

+0

安裝libagg-dev軟件包,並將libagg消息更改爲「libagg:yes [需要上游未合併的修補程序。使用本地副本]」 – mp94 2014-08-31 19:14:28

回答

12

我看到相同的錯誤消息,並安裝在這篇文章中提到的依賴Pip install Matplotlib error with virtualenv解決了我的問題。

+7

安裝三個建議那裏的軟件包,'libjpeg8-dev','libfreetype6-dev'和'libpng12-dev'工作! (我已經安裝了freetype和png軟件包)也按照原始帖子的評論推薦的那樣安裝了'libagg-dev'。 – mp94 2014-08-31 19:21:34

+5

sudo apt-get build-dep matplotlib在Ubuntu上爲我工作14.04 – 2014-09-04 07:53:24

+3

在mac上:'brew install freetype' – 2015-05-04 22:55:49