簡體   English   中英

在Mac上使用pip在virtualenv內安裝matplotlib

[英]Installing matplotlib inside a virtualenv using pip on a Mac

建議*為python安裝matplotlib的命令是:

pip install -U git+git://github.com/matplotlib/matplotlib.git

選擇virtualenv然后運行該命令之后,我收到了看起來像是肯定的結果,直到:

* The following required packages can not be built:

                        * freetype

但是我在整個系統上都有freetypefreetype2即使在Anaconda安裝中也是如此。 我嘗試將各種路徑添加到$PATH例如:

/anaconda/include/freetype2/freetype
/anaconda/include/freetype2/
/anaconda/include/
//anaconda/include/freetype2/freetype

而且似乎沒有任何作用,至少就調用which freetype

有沒有其他方法可以向系統顯示我具有自由類型? 我只是在濫用$PATH嗎?

*來自“ Scipy Superpack for Homebrew”的建議


這是安裝失敗的整體輸出:

Downloading/unpacking git+git://github.com/matplotlib/matplotlib.git
Cloning git://github.com/matplotlib/matplotlib.git to /var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build
Running setup.py (path:/var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build/setup.py) egg_info for package from git+git://github.com/matplotlib/matplotlib.git
============================================================================
Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.5.dev1]
                python: yes [2.7.6 (default, Sep  9 2014, 15:04:36)  [GCC
                        4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]]
              platform: yes [darwin]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.9.0]
              dateutil: yes [using dateutil version 2.2]
                  pytz: yes [using pytz version 2014.7]
               tornado: yes [using tornado version 4.1]
             pyparsing: yes [using pyparsing version 2.0.3]
                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.5.13]
                 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.3.4 / using mock 1.0.1]
        toolkits_tests: yes [using nose version 1.3.4 / using mock 1.0.1]

OPTIONAL BACKEND EXTENSIONS
                macosx: yes [installing, darwin]
                qt5agg: no  [PyQt5 not found]
                qt4agg: no  [PySide not found; 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: no
                 latex: no
               pdftops: no

============================================================================
                        * The following required packages can not be built:
                        * freetype

來自命令python setup.py egg_info完整輸出:

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

Edit `setup.cfg` to change the build options



BUILDING MATPLOTLIB

            matplotlib: yes [1.5.dev1]

                python: yes [2.7.6 (default, Sep  9 2014, 15:04:36)  [GCC

                        4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)]]

              platform: yes [darwin]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [version 1.9.0]

              dateutil: yes [using dateutil version 2.2]

                  pytz: yes [using pytz version 2014.7]

               tornado: yes [using tornado version 4.1]

             pyparsing: yes [using pyparsing version 2.0.3]

                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.5.13]

                 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.3.4 / using mock 1.0.1]

        toolkits_tests: yes [using nose version 1.3.4 / using mock 1.0.1]



OPTIONAL BACKEND EXTENSIONS

                macosx: yes [installing, darwin]

                qt5agg: no  [PyQt5 not found]

                qt4agg: no  [PySide not found; 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: no

                 latex: no

               pdftops: no



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

                        * The following required packages can not be built:

                        * freetype

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /var/folders/pl/9hfxwbf17knbpqpmdd4tq5j00000gn/T/pip-ZGwnWX-build
Storing debug log for failure in /Users/rpanos/.pip/pip.log

也許這根本不是您想要的,但是您可以使用conda來創建環境嗎? 例如, conda create -n myenv anaconda嗎? 那已經有matplotlib了。 您還可以完全自定義輸入內容。

我遇到過同樣的問題。 它為我工作的方式如下:

sudo apt-get -y build-dep matplotlib  # then enter you root password
virtualenv -p python2.7 ~/venv
source ~/venv/bin/activate

關鍵是安裝系統范圍的matplotlib依賴項的第一步。 這里的來源。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM