如何在virtualenv中在Mac 10.7上安装MatPlotLib

时间:2011-08-04 06:08:31

标签: python install matplotlib virtualenv

这是我尝试做的事情:

(SAASSenv)miki725mac:SAASSenv miki725$ python
Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
(SAASSenv)miki725mac:SAASSenv miki725$ 
(SAASSenv)miki725mac:SAASSenv miki725$ pip install http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz
Downloading/unpacking http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz
  Downloading matplotlib-1.0.1.tar.gz (13.3Mb): 13.3Mb downloaded
  Running setup.py egg_info for package from http://downloads.sourceforge.net/project/matplotlib/matplotlib/matplotlib-1.0.1/matplotlib-1.0.1.tar.gz
    basedirlist is: []
    ============================================================================
    BUILDING MATPLOTLIB
                matplotlib: 1.0.1
                    python: 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
                            [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]
                  platform: darwin

    REQUIRED DEPENDENCIES
                     numpy: 1.6.0
                 freetype2: 13.0.7

    OPTIONAL BACKEND DEPENDENCIES
                    libpng: 1.4.8
    Traceback (most recent call last):
      File "<string>", line 14, in <module>
      File "/var/folders/tk/xpmf2q_10qg45c9g_xzmvy4r0000gn/T/pip-02sOum-build/setup.py", line 162, in <module>
        if check_for_tk() or (options['build_tkagg'] is True):
      File "setupext.py", line 832, in check_for_tk
        (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion))
    IndexError: list index out of range
    Complete output from command python setup.py egg_info:
    basedirlist is: []

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

BUILDING MATPLOTLIB

            matplotlib: 1.0.1

                python: 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)

                        [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

              platform: darwin



REQUIRED DEPENDENCIES

                 numpy: 1.6.0

             freetype2: 13.0.7



OPTIONAL BACKEND DEPENDENCIES

                libpng: 1.4.8

Traceback (most recent call last):

  File "<string>", line 14, in <module>

  File "/var/folders/tk/xpmf2q_10qg45c9g_xzmvy4r0000gn/T/pip-02sOum-build/setup.py", line 162, in <module>

    if check_for_tk() or (options['build_tkagg'] is True):

  File "setupext.py", line 832, in check_for_tk

    (Tkinter.__version__.split()[-2], Tkinter.TkVersion, Tkinter.TclVersion))

IndexError: list index out of range

----------------------------------------
Command python setup.py egg_info failed with error code 1
Storing complete log in /Users/miki725/.pip/pip.log

请帮帮我。如果您需要任何其他信息,请告诉我。谢谢。

3 个答案:

答案 0 :(得分:25)

locojays行对我不起作用(osx 10.7,Python 2.7.2通过自制程序),我不得不修改命令如下:

pip install -e git+https://github.com/matplotlib/matplotlib.git#egg=matplotlib

答案 1 :(得分:8)

只是做

pip install -e https://github.com/matplotlib/matplotlib.git matplotlib

或克隆然后安装

或看看@

http://jholewinski.org/blog/installing-matplotlib-on-os-x-10-7-with-homebrew/

但这不是一个狮子问题只是一个python 2.7.2错误。在同事雪豹机上遇到同样的问题

假设您正在使用brew

希望这会有所帮助

答案 2 :(得分:1)

使用OSX 10.7,我使用了“Scipy Superpack”安装脚本,现在我的matplotlib工作正常。

http://fonnesbeck.github.com/ScipySuperpack/

花了两步几分钟:

  

安装

     

Download Scipy Superpack Installer for OSX 10.7

     

要安装,请在脚本所在的目录中打开终端   找到并致电:

     

$ sh install_superpack.sh

     

系统会提示您输入管理员   密码。如果您已经安装了当前的gFortran,则可以   在安装过程中绕过该包。同样,   安装需要Git,因此如果您将被提示安装它   你正在远程安装。