2015-12-14 48 views
2

簡單升級matplotlib 1.5在OS X 10.11失敗,因爲FreeType的

sudo pip install matplotlib --upgrade 

失敗與以下日誌:

Downloading/unpacking matplotlib from https://pypi.python.org/packages/source/m/matplotlib/matplotlib-1.5.0.tar.gz#md5=7952a539418ed77432aa4727409f24cf 
    Running setup.py egg_info for package matplotlib 
    ============================================================================ 
    Edit setup.cfg to change the build options 

    BUILDING MATPLOTLIB 
       matplotlib: yes [1.5.0] 
        python: yes [2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12 
          2012, 11:14:05) [GCC 4.0.1 (Apple Inc. build 
          5493)]] 
        platform: yes [darwin] 

    REQUIRED DEPENDENCIES AND EXTENSIONS 
        numpy: yes [version 1.10.1] 
        dateutil: yes [using dateutil version 2.4.2] 
         pytz: yes [using pytz version 2015.7] 
        cycler: yes [cycler was not found. pip will attempt to 
          install it after matplotlib.] 
        tornado: yes [using tornado version 2.2] 
       pyparsing: yes [Your pyparsing contains a bug that will be 
          monkey-patched by matplotlib. For best results, 
          upgrade to pyparsing 2.0.1 or later.] 
        libagg: yes [pkg-config information for 'libagg' could not 
          be found. Using local copy.] 
        freetype: no [The C/C++ header for freetype2 (ft2build.h) 
          could not be found. You may need to install the 
          development package.] 
         png: yes [version 1.6.18] 
        qhull: yes [pkg-config information for 'qhull' could not be 
          found. Using local copy.] 

    OPTIONAL SUBPACKAGES 
       sample_data: yes [installing] 
        toolkits: yes [installing] 
        tests: yes [using nose version 1.1.2/mock is required to 
          run the matplotlib test suite. "setup.py test" will 
          automatically download it. Install mock to run 
          matplotlib.test()] 
      toolkits_tests: yes [using nose version 1.1.2/mock is required to 
          run the matplotlib test suite. "setup.py test" will 
          automatically download it. Install mock to run 
          matplotlib.test()] 

    OPTIONAL BACKEND EXTENSIONS 
        macosx: yes [installing, darwin] 
        qt5agg: no [PyQt5 not found] 
        qt4agg: yes [installing, Qt: 4.7.3, PySide: 1.1.0; PyQt4 not 
          found] 
        gtk3agg: no [Requires pygobject to be installed.] 
       gtk3cairo: no [Requires cairocffi or pycairo to be installed.] 
        gtkagg: no [Requires pygtk] 
        tkagg: yes [installing, version 81008] 
        wxagg: no [requires wxPython] 
         gtk: no [Requires pygtk] 
         agg: yes [installing] 
        cairo: no [cairocffi or pycairo not found] 
       windowing: no [Microsoft Windows only] 

    OPTIONAL LATEX DEPENDENCIES 
        dvipng: no 
       ghostscript: yes [version 9.16] 
        latex: no 
        pdftops: no 

    OPTIONAL PACKAGE DATA 
         dlls: no [skipping due to configuration] 

    ============================================================================ 
          * The following required packages can not be built: 
          * freetype 
    Complete output from command python setup.py egg_info: 
    ============================================================================ 

Edit setup.cfg to change the build options 



BUILDING MATPLOTLIB 

      matplotlib: yes [1.5.0] 

       python: yes [2.7.3 |EPD 7.3-2 (64-bit)| (default, Apr 12 

         2012, 11:14:05) [GCC 4.0.1 (Apple Inc. build 

         5493)]] 

       platform: yes [darwin] 



REQUIRED DEPENDENCIES AND EXTENSIONS 

       numpy: yes [version 1.10.1] 

       dateutil: yes [using dateutil version 2.4.2] 

        pytz: yes [using pytz version 2015.7] 

       cycler: yes [cycler was not found. pip will attempt to 

         install it after matplotlib.] 

       tornado: yes [using tornado version 2.2] 

      pyparsing: yes [Your pyparsing contains a bug that will be 

         monkey-patched by matplotlib. For best results, 

         upgrade to pyparsing 2.0.1 or later.] 

       libagg: yes [pkg-config information for 'libagg' could not 

         be found. Using local copy.] 

       freetype: no [The C/C++ header for freetype2 (ft2build.h) 

         could not be found. You may need to install the 

         development package.] 

        png: yes [version 1.6.18] 

       qhull: yes [pkg-config information for 'qhull' could not be 

         found. Using local copy.] 



OPTIONAL SUBPACKAGES 

      sample_data: yes [installing] 

       toolkits: yes [installing] 

       tests: yes [using nose version 1.1.2/mock is required to 

         run the matplotlib test suite. "setup.py test" will 

         automatically download it. Install mock to run 

         matplotlib.test()] 

     toolkits_tests: yes [using nose version 1.1.2/mock is required to 

         run the matplotlib test suite. "setup.py test" will 

         automatically download it. Install mock to run 

         matplotlib.test()] 



OPTIONAL BACKEND EXTENSIONS 

       macosx: yes [installing, darwin] 

       qt5agg: no [PyQt5 not found] 

       qt4agg: yes [installing, Qt: 4.7.3, PySide: 1.1.0; PyQt4 not 

         found] 

       gtk3agg: no [Requires pygobject to be installed.] 

      gtk3cairo: no [Requires cairocffi or pycairo to be installed.] 

       gtkagg: no [Requires pygtk] 

       tkagg: yes [installing, version 81008] 

       wxagg: no [requires wxPython] 

        gtk: no [Requires pygtk] 

        agg: yes [installing] 

       cairo: no [cairocffi or pycairo not found] 

      windowing: no [Microsoft Windows only] 



OPTIONAL LATEX DEPENDENCIES 

       dvipng: no 

      ghostscript: yes [version 9.16] 

       latex: no 

       pdftops: no 



OPTIONAL PACKAGE DATA 

        dlls: no [skipping due to configuration] 



============================================================================ 

         * The following required packages can not be built: 

         * freetype 

---------------------------------------- 
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/matplotlib 
Storing complete log in /Users/vlad-arisolteanu/.pip/pip.log 

同時,

brew install freetype 

回報:

Warning: freetype-2.6_1 already installed 

所以它看起來像freetype安裝在我的系統上。那麼發生了什麼?令人失望的是,沒有安裝像matplotlib這樣的關鍵Python包。

任何幫助,將不勝感激。

+0

另一方面,找不到'ls -l/usr/include/freetype2/ft2build.h'。 – WindChimes

+0

您是否試圖將matplotlib安裝到系統Python中?這似乎並不像是將它安裝到'brew'管理的Python中。 – birryree

+0

我正在安裝到Enthought(目前設置爲默認的Python解釋器)。 – WindChimes

回答

2

由於您使用的是Enthought,因此安裝諸如matplotlib之類的東西的推薦方法是安裝Canopy Express,它是Enthought分配的免費附加組件,也允許您訪問大約100個可輕鬆安裝的軟件包進入慾望。

你試圖用brew做什麼,等不適用於Enthought開箱即用,並且需要你設置正確的環境變量和構建設置,因爲整個系統並不瞭解brew的存在。

1

其可能需要安裝pkg-config。請嘗試:

brew install pkg-config 

安裝之前matplotlib

請參閱here瞭解更多關於此的討論。聽起來好像matplotlibfreetype的路徑感到困惑,但pkg-config覆蓋了這個並設置了正確的路徑。還有matplotlib自述文件here,這表明您需要pkg-config

+0

我以前見過這個解決方案。但是brew會返回警告:已經安裝了pkg-config-0.29。另外,找不到'ls -l/usr/include/freetype2/ft2build.h'。 – WindChimes

+0

它存在於別的地方嗎?例如'在/ usr /本地/庫/ freetype的/ 2.6.1 /包括/ freetype2'?如果是這樣,你可以'ln -s /usr/local/Cellar/freetype/2.6.1/include/freetype2/usr/include/freetype' – tom

+0

謝謝,這已經被@birryree回答了。更普遍的問題是我使用的是不是由'brew'管理的Python解釋器。 – WindChimes

0

我使用matplotlib,OSX 10.11,Python的3.6和1.5.1 matplotlib

使virtualenv(與在它沒有空格的路徑) 我已經有蟒蛇3安裝,我發現給符號鏈接沒有安裝它,所以我沿着symlink到python3.6文件並使用它。使用virtualenv -p命令。

我安裝了xquartz默認情況下不在osx的東西,matplotlib仍然不會安裝。也就是說,直到我發現了matplotlib安裝的東西看起來/include/ft2buid.h沒有/include/freetype2/ft2build.h,所以我設置在圖書館的/freetype2/ft2build.h文件一個符號鏈接,然後跑了點子安裝matplotlib和它的工作

Python是沒有安裝的框架...

我試圖使這個文件稱爲框架蟒是重新路由到Python或東西,但沒有奏效 最後,我發現一張紙條,說去文件夾:

~/.matplotlib(字面粘貼在去文件夾對話逐字) 的n請叫matplotlibrc(沒有文件擴展名),一個純文本文件,只是有文字: 後端:TkAgg

,這就是我所說的巫術,現在matplotlib雨演示工作

這個具體問題可能只需要一個符號鏈接位,我給了自己額外的virtualenv複雜性,但我不記得原因。