Can't upgrade matplotlib in Ubuntu 12.04 with

2020-03-03 07:15发布

I'm trying to upgrade matplotlib in Ubuntu 12.04. When I run the command:

sudo pip install --upgrade matplotlib

I get this 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

So I run:

easy_install -U distribute

and I get:

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

So there's something not working with my Canopy install. I'm using Spyder right now so I could uninstall Canopy to see if that helps, but the commands sudo apt-get remove enthought* and sudo apt-get remove canopy* find nothing to remove.

What can I do to upgrade matplotlib?


Add

I followed the instructions to remove Canopy from here and now when I run easy_install -U distribute I get:

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

which I believe is related with me deleting the line source ~/Enthought/Canopy_64bit/User/bin/activate from ~/.profile. I tried running the following commands as 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

but that did not work. Any ideas on how to fix this?


Add 2

I tried setting PYTHONHOME with the command:

export PYTHONHOME=/usr/lib/python2.7

and now easy_install -U distribute returns:

ImportError: No module named site

Same thing with:

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

So now off to chase that error.


Add 3

Setting:

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

and then running the command as sudo:

sudo easy_install -U distribute

did the trick. I could then run sudo pip install --upgrade matplotlib. I'll add this as an answer in a minute.

1条回答
再贱就再见
2楼-- · 2020-03-03 07:29

After removing Canopy I run:

export PYTHONHOME=/usr/lib/python2.7/
sudo easy_install -U distribute
sudo pip install --upgrade matplotlib

I could upgrade matplotlib that way.

查看更多
登录 后发表回答