No se puede actualizar matplotlib en Ubuntu 12.04 con Canopy instalado

Estoy tratando de actualizarmatplotlib enUbuntu 12.04. Cuando ejecuto el comando:

sudo pip install --upgrade matplotlib

Me sale este error:

Downloading/unpacking matplotlib
  Running setup.py egg_info for package matplotlib
    The required version of distribute (>=0.6.28) is not available,
    and can't be installed while this script is running. Please
    install a more recent version first, using
    'easy_install -U distribute'.

    (Currently using distribute 0.6.24dev-r0 (/usr/lib/python2.7/dist-packages))
    Complete output from command python setup.py egg_info:
    The required version of distribute (>=0.6.28) is not available,

and can't be installed while this script is running. Please

install a more recent version first, using

'easy_install -U distribute'.

(Currently using distribute 0.6.24dev-r0 (/usr/lib/python2.7/dist-packages))

----------------------------------------
Command python setup.py egg_info failed with error code 2
Storing complete log in /home/gabriel/.pip/pip.log

Así que corro:

easy_install -U distribute

y me sale:

Traceback (most recent call last):
  File "/home/gabriel/Enthought/Canopy_32bit/User/bin/easy_install", line 9, in <module>
    load_entry_point('distribute', 'console_scripts', 'easy_install')()
  File "/home/gabriel/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/setuptools-0.9.8-py2.7.egg/pkg_resources.py", line 378, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/gabriel/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/setuptools-0.9.8-py2.7.egg/pkg_resources.py", line 2565, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group,name),))
ImportError: Entry point ('console_scripts', 'easy_install') not found

Así que hay algo que no funciona con miCanopy instalar. Estoy usandoSpyder ahora mismo para que pueda desinstalarCanopy para ver si eso ayuda, pero los comandossudo apt-get remove enthought* ysudo apt-get remove canopy* no encuentra nada para eliminar.

¿Qué puedo hacer para actualizar matplotlib?

Añadir

Seguí las instrucciones para quitarCanopy desdeaquí y ahora cuando corroeasy_install -U distribute Yo obtengo:

Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

Lo que creo está relacionado conmigo al borrar la línea.source ~/Enthought/Canopy_64bit/User/bin/activate desde~/.profile. Intenté ejecutar los siguientes comandos como sudo:

apt-get autoclean
apt-get clean
apt-get update
apt-get upgrade
apt-get dist-upgrade
apt-get -f install
dpkg --configure -a
apt-get install --reinstall python

Pero eso no funcionó. ¿Alguna idea sobre cómo solucionar este problema?

Añadir 2

Intenté establecerPYTHONHOME con el comando:

export PYTHONHOME=/usr/lib/python2.7

y ahoraeasy_install -U distribute devoluciones:

ImportError: No module named site

Lo mismo con:

export PYTHONHOME=/usr/local/lib/python2.7

Así que ahora vamos a perseguir ese error.

Añadir 3

Ajuste:

export PYTHONHOME=/usr/lib/python2.7/

y luego ejecutando el comando comosudo:

sudo easy_install -U distribute

Hizo el truco. Entonces podria corrersudo pip install --upgrade matplotlib. Añadiré esto como respuesta en un minuto.

Respuestas a la pregunta(1)

Su respuesta a la pregunta