2016-02-20 90 views
-1

所以我在全局安裝了Python 3和matplotlib。如果我在虛擬環境之外運行python並導入matplotlib來檢查它顯示的版本1.5.1。但是我正面臨在虛擬環境中安裝matplotlib的問題。我使用命令python3 -m venv ds創建了一個虛擬環境,並激活了ds。這些都是我的requirements.txtMatplotlib不在virtualenv內部安裝mac

matplotlib==1.4.2 numpy==1.9.1

內容當我做pip3 install -r requirements.txt我得到這個

Collecting matplotlib==1.4.2 (from -r requirements.txt (line 1)) 
    Using cached matplotlib-1.4.2.tar.gz 
    Complete output from command python setup.py egg_info: 
    Traceback (most recent call last): 
     File "<string>", line 20, in <module> 
     File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setup.py", line 155, in <module> 
     result = package.check() 
     File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 962, in check 
     min_version='2.3', version=version) 
     File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 446, in _check_for_pkg_config 
     if (not is_min_version(version, min_version)): 
     File "/private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib/setupext.py", line 174, in is_min_version 
     return found_version >= expected_version 
     File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py", line 70, in __ge__ 
     c = self._cmp(other) 
     File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/distutils/version.py", line 337, in _cmp 
     if self.version < other.version: 
    TypeError: unorderable types: str() < int() 
    IMPORTANT WARNING: 
     pkg-config is not installed. 
     matplotlib may not be able to find some of its dependencies 
    ============================================================================ 
    Edit setup.cfg to change the build options 

    BUILDING MATPLOTLIB 
       matplotlib: yes [1.4.2] 
        python: yes [3.5.1 (v3.5.1:37a07cee5969, Dec 5 2015, 
          21:12:44) [GCC 4.2.1 (Apple Inc. build 5666) (dot 
          3)]] 
        platform: yes [darwin] 

    REQUIRED DEPENDENCIES AND EXTENSIONS 
        numpy: yes [version 1.10.4] 
         six: yes [using six version 1.10.0] 
        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.] 
        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 [Official versions of PyCXX are not compatible 
          with matplotlib on Python 3.x, since they lack 
          support for the buffer object. Using local copy] 
        libagg: yes [pkg-config information for 'libagg' could not 
          be found. Using local copy.] 

    ---------------------------------------- 
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/ym/gfrm424x31j4vd944cdhn4hr0000gn/T/pip-build-pcfq8bhb/matplotlib 
You are using pip version 7.1.2, however version 8.0.2 is available. 
You should consider upgrading via the 'pip install --upgrade pip' command. 

我應該如何在虛擬環境中安裝matplotlib 1.4.2版本?

我的問題已被標記爲重複,但該鏈接不能解決我的問題。給出的解決方案適用於Ubuntu

+0

可能的重複[Matplotlib編譯錯誤:TypeError:unorderable types:str() orange

回答

1

我能夠通過求解matplotlib, 依賴做到這一點(如果你有安裝brew) 然後首先做brew install freetype其次brew install ttfautohint --with-qt。之後,再次嘗試點安裝。

0

您可以在virtualenv中使用系統軟件包,並使用this選項。

否則,this SO post可能會幫助你。

+0

如何在mac上安裝libfreetype6-dev? – AbKDs

+0

你用Google嗎? – orange

+0

是的,如果我們有釀造,我們可以做brew安裝freetype – AbKDs