【问题标题】:Install Matplot Lib Mac - Mavericks - Error pyplot安装 Matplotlib Mac - Mavericks - 错误 pyplot
【发布时间】:2014-12-07 07:26:53
【问题描述】:

我尝试了多种方式安装 matplotlib,并且成功使用 - 通过 github 下载,将目录更改为文件夹,然后运行 ​​sudo python setup.py install。但是,pyplot 无法正常工作,所以我卸载了,我尝试使用 pip 并且遇到了大量错误。

Megans-MacBook-Pro:~ MeganRCunninghan$ sudo pip install matplotlib
Downloading/unpacking matplotlib
  Running 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.5 (default, Mar  9 2014, 22:15:05)  [GCC
                            4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]]
                  platform: yes [darwin]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [version 1.6.2]
                       six: yes [six was not found.]
                  dateutil: yes [using dateutil version 1.5]
                   tornado: yes [tornado was not found. It is required for the
                            WebAgg backend. pip/easy_install may attempt to
                            install it after matplotlib.]
                 pyparsing: yes [pyparsing was not found. It is required for
                            mathtext support. pip/easy_install may attempt to
                            install it after matplotlib.]
                     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 16, in <module>
      File "/tmp/pip-build/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



BUILDING MATPLOTLIB

            matplotlib: yes [1.4.0]

                python: yes [2.7.5 (default, Mar  9 2014, 22:15:05)  [GCC

                        4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)]]

              platform: yes [darwin]



REQUIRED DEPENDENCIES AND EXTENSIONS

                 numpy: yes [version 1.6.2]

                   six: yes [six was not found.]

              dateutil: yes [using dateutil version 1.5]

               tornado: yes [tornado was not found. It is required for the

                        WebAgg backend. pip/easy_install may attempt to

                        install it after matplotlib.]

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

                        mathtext support. pip/easy_install may attempt to

                        install it after matplotlib.]

                 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 16, in <module>

  File "/tmp/pip-build/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

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

当我使用 python 并输入时

>>import matplot lib 

它可以工作,但是当我想要 matplotlib.pyplot 时出现错误:

>>> import matplotlib.pyplot as plt

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    import matplotlib.pyplot as plt
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/pyplot.py", line 26, in <module>
    from matplotlib.figure import Figure, figaspect
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 24, in <module>
    import matplotlib.artist as martist
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/artist.py", line 7, in <module>
    from transforms import Bbox, IdentityTransform, TransformedBbox, \
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/transforms.py", line 35, in <module>
    from matplotlib._path import (affine_transform, count_bboxes_overlapping_bbox,
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so, 2): no suitable image found.  Did find:
    /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/_path.so: no matching architecture in universal wrapper

【问题讨论】:

    标签: python macos python-2.7 matplotlib


    【解决方案1】:

    所以我解决了这个问题: 通过python中的安装目录手动卸载matplotlib:

    >>> import matplotlib
    >>> matplotlib.__file__
    

    然后我转到我的查找器并使用 CMD+Shift+G 找到文件夹并粘贴给定的文件位置。 选择 matplotlib 文件并删除。 转到 cmd 行并输入

    sudo pip install matplotlib
    

    现在可以了。 此外,在运行 pip 之前,我安装了 xcode 并使用以下说明修复了 clang 和 lipo 之间的挂起: 安装xcode,去终端-

     xcode-select --install
    

    在以下位置安装命令行工具:https://developer.apple.com/downloads/index.action?=command%20line%20tools#

    转到终端:

    sudo mv /usr/bin/lipo /usr/bin/lipo.orig sudo 
    ln -s /Library/Developer/CommandLineTools/usr/bin/lipo /usr/bin
    

    如果没有,请安装 Pip:

    sudo su 
    easy_install pip
    

    【讨论】:

      【解决方案2】:

      我强烈建议您安装Anaconda。它解决了安装科学相关模块时出现的很多问题。

      【讨论】:

      • 谢谢!我解决了这个问题,但我会检查这个以了解未来的问题。 :)
      猜你喜欢
      • 2014-10-31
      • 2014-01-11
      • 2013-11-12
      • 2021-12-13
      • 2013-11-03
      • 2014-02-09
      • 2014-11-19
      • 2014-04-29
      • 2014-09-08
      相关资源
      最近更新 更多