Python pip 安装异常 matplotlib

标签 python python-2.7 matplotlib

操作系统:OSX 10.11.3。

我已经安装了 Python:2.7.10 和 3.4.2。

执行命令:pip install matplotlib

pip安装日志

pip install matplotlib Downloading/unpacking matplotlib Downloading matplotlib-1.5.1.tar.gz (54.0MB): 54.0MB downloaded Running setup.py (path:/private/var/folders/x1/prmwnk854tj25kslmzb10l5h0000gn/T/pip_build_calebebrim/matplotlib/setup.py) egg_info for package matplotlib ============================================================================ Edit setup.cfg to change the build options

BUILDING MATPLOTLIB
            matplotlib: yes [1.5.1]
                python: yes [2.7.8 (default, Oct 19 2014, 16:06:28)  [GCC
                        4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]]
              platform: yes [darwin]

REQUIRED DEPENDENCIES AND EXTENSIONS
                 numpy: yes [version 1.10.4]
              dateutil: yes [dateutil was not found. It is required for date
                        axis support. pip/easy_install may attempt to
                        install it after matplotlib.]
                  pytz: yes [pytz was not found. pip will attempt to install
                        it after matplotlib.]
                cycler: yes [cycler was not found. pip will attempt to
                        install it after matplotlib.]
               tornado: yes [using tornado version 4.3]
             pyparsing: yes [pyparsing was not found. It is required for
                        mathtext support. pip/easy_install may attempt to
                        install it after matplotlib.]
                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.23]
                 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 [nose 0.11.1 or later is required to run the
                        matplotlib test suite. Please install it with pip or
                        your preferred tool to run the test suite / mock is
                        required to run the matplotlib test suite. Please
                        install it with pip or your preferred tool to run
                        the test suite]
        toolkits_tests: yes [nose 0.11.1 or later is required to run the
                        matplotlib test suite. Please install it with pip or
                        your preferred tool to run the test suite / mock is
                        required to run the matplotlib test suite. Please
                        install it with pip or your preferred tool to run
                        the test suite]

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: yes [version 9.10]
                 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.1]

            python: yes [2.7.8 (default, Oct 19 2014, 16:06:28)  [GCC

                    4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)]]

          platform: yes [darwin]

REQUIRED DEPENDENCIES AND EXTENSIONS

             numpy: yes [version 1.10.4]

          dateutil: yes [dateutil was not found. It is required for date

                    axis support. pip/easy_install may attempt to

                    install it after matplotlib.]

              pytz: yes [pytz was not found. pip will attempt to install

                    it after matplotlib.]

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

                    install it after matplotlib.]

           tornado: yes [using tornado version 4.3]

         pyparsing: yes [pyparsing was not found. It is required for

                    mathtext support. pip/easy_install may attempt to

                    install it after matplotlib.]

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

             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 [nose 0.11.1 or later is required to run the

                    matplotlib test suite. Please install it with pip or

                    your preferred tool to run the test suite / mock is

                    required to run the matplotlib test suite. Please

                    install it with pip or your preferred tool to run

                    the test suite]

    toolkits_tests: yes [nose 0.11.1 or later is required to run the

                    matplotlib test suite. Please install it with pip or

                    your preferred tool to run the test suite / mock is

                    required to run the matplotlib test suite. Please

                    install it with pip or your preferred tool to run

                    the test suite]

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: yes [version 9.10]

             latex: no

           pdftops: no

OPTIONAL PACKAGE DATA

              dlls: no  [skipping due to configuration]

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

                    * The following required packages can not be built:

                    * freetype

Removing temporary dir /private/var/folders/x1/prmwnk854tj25kslmzb10l5h0000gn/T/pip_build_calebebrim... Command python setup.py egg_info failed with error code 1 in /private/var/folders/x1/prmwnk854tj25kslmzb10l5h0000gn/T/pip_build_calebebrim/matplotlib Exception information: Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1229, in prepare_files req_to_install.run_egg_info() File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 325, in run_egg_info command_desc='python setup.py egg_info') File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess % (command_desc, proc.returncode, cwd)) InstallationError: Command python setup.py egg_info failed with error code 1 in /private/var/folders/x1/prmwnk854tj25kslmzb10l5h0000gn/T/pip_build_calebebrim/matplotlib

这个用于:sudo pip install matplotlib

Cleaning up... Removing temporary dir /private/tmp/pip_build_root... Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/matplotlib Exception information: Traceback (most recent call last): File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 278, in run requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1229, in prepare_files req_to_install.run_egg_info() File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 325, in run_egg_info command_desc='python setup.py egg_info') File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/util.py", line 697, in call_subprocess % (command_desc, proc.returncode, cwd)) InstallationError: Command python setup.py egg_info failed with error code 1 in /private/tmp/pip_build_root/matplotlib

我应该做什么?

我发现了这个: https://github.com/matplotlib/matplotlib/issues/3029/ 它说执行 sudo apt-get pkg-config 或在 osx 上,brew install pkg-config 应该可以修复所有问题。

但是执行brew install pkgconfig 我得到了这个:

Warning: pkg-config-0.28 already installed

最佳答案

在Mac上使用pip时需要使用sudo,否则pip无法正常访问所需的文件夹特权。因此,将 sudo 放在命令之前:

sudo pip install matplotlib

您还需要输入管理员密码,然后就会安装。

关于Python pip 安装异常 matplotlib,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36341660/

相关文章:

python - 柯里化(Currying) UDF - Pyspark

python - 如何使用 SQLAlchemy 检查 PostgreSQL 模式是否存在?

python - 如何使用 argparse 删除 CLI 参数,以便 unittest 接受 arg 列表

python - 样式文件中的 matplotlib savefig.directory 不起作用

python - 如何使 pandas 子图中的线条变粗

python - 启动 celery worker 时出现 ValueError : not enough values to unpack (expected 3, 为 0)

python - 使用 h5py 读取 HDF5 文件时使用 python 切片对象?

python - 如何在程序运行时中断它?

python - 使用 MSSQL 通过 QgsVectorLayer 加载矢量图层

python - 如何复制matplotlib图形?