2014-11-19 12 views
16

Sto cercando di aggiungere matplotlib-1.4.2 su python 3.4 utilizzando python setup.py build. Secondo la documentazione è supportato su Python 3.4. Viene visualizzato il seguente messaggio di errore:Errore di compilazione Matplotlib: TypeError: tipi non ordinabili: 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.4.0 (default, Nov 17 2014, 15:12:48) [GCC 
         4.1.2 20080704 (Red Hat 4.1.2-48)]] 
       platform: yes [linux] 

REQUIRED DEPENDENCIES AND EXTENSIONS 
       numpy: yes [version 1.9.1] 
        six: yes [using six version 1.8.0] 
       dateutil: yes [using dateutil version 2.2] 
        pytz: yes [using pytz version 2014.9] 
       tornado: yes [using tornado version 4.0.2] 
      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.] 
Traceback (most recent call last): 
    File "setup.py", line 155, in <module> 
    result = package.check() 
    File "https://stackoverflow.com/users/tools/downloads/matplotlib-1.4.2/setupext.py", line 962, in check 
    min_version='2.3', version=version) 
    File "https://stackoverflow.com/users/tools/downloads/matplotlib-1.4.2/setupext.py", line 446, in _check_for_pkg_config 
    if (not is_min_version(version, min_version)): 
    File "https://stackoverflow.com/users/tools/downloads/matplotlib-1.4.2/setupext.py", line 174, in is_min_version 
    return found_version >= expected_version 
    File "https://stackoverflow.com/users/tools/python-3.4.0/lib/python3.4/distutils/version.py", line 76, in __ge__ 
    c = self._cmp(other) 
    File "https://stackoverflow.com/users/tools/python-3.4.0/lib/python3.4/distutils/version.py", line 342, in _cmp 
    if self.version < other.version: 
TypeError: unorderable types: str() < int() 

Gentilmente aiutare a risolverlo.

+0

Sembra che la tua build di matplotlib sia stata pensata per Python 2.x, dove puoi confrontare stringhe con int. Sei sicuro di aver installato la versione giusta? – iCodez

+1

https://pypi.python.org/pypi/matplotlib. Ha detto che è supportato per python3 – Raj

risposta

52

Mi sono imbattuto in un errore simile ed è stato in grado di risolverlo installando una dipendenza opzionale. In particolare, nella mia situazione, c'è un "bug" in distutil dove i confronti di numeri di versione liberi possono innescare un errore in Python 3 a causa di confronti impliciti di tipi stringa e interi in distutils/versione.py: 343, che viene chiamata dall'impostazione di Matplotlib. py. Vedi Issue 14894 per maggiori dettagli se li vuoi.

Poiché la dipendenza opzionale non è stata installata, il controllo del numero di versione restituiva una stringa ("Impossibile identificare la versione") e, naturalmente, non può essere confrontata con una versione numerica, che ha generato la stessa eccezione che si è vista .

sudo apt-get install libfreetype6-dev 
pip install matplotlib 

libfreetype installata (una dipendenza opzionale), LooseVersion di distutil ha visto un numero di versione e il confronto è stato digitato correttamente. Matplotlib ha installato bene successivamente.

+1

Sì. Ha funzionato per me con Python 3.4 su Ubuntu 14.10. – Reece

+1

Confermato per funzionare con python3.4 su debian 8. – Geeklhem

Problemi correlati