在安装了Canopy的Ubuntu 12.04中无法升级matplotlib

时间:2013-08-05 17:34:00

标签: python matplotlib upgrade enthought canopy

我正在尝试升级matplotlib中的Ubuntu 12.04。当我运行命令时:

sudo pip install --upgrade matplotlib

我收到此错误:

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

所以我跑:

easy_install -U distribute

我得到了:

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

因此我的Canopy安装无效。我现在正在使用Spyder,因此我可以卸载Canopy以查看是否有帮助,但命令sudo apt-get remove enthought*sudo apt-get remove canopy*找不到要删除的内容。

升级matplotlib怎么办?


添加

我按照说明从here删除了Canopy,现在当我运行easy_install -U distribute时,我得到了:

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

我认为这与我从source ~/Enthought/Canopy_64bit/User/bin/activate删除行~/.profile有关。我尝试将以下命令作为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

但这不起作用。关于如何解决这个问题的任何想法?


添加2

我尝试使用以下命令设置PYTHONHOME

export PYTHONHOME=/usr/lib/python2.7

现在easy_install -U distribute返回:

ImportError: No module named site

同样的事情:

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

现在开始追逐那个错误。


添加3

环境:

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

然后以sudo

运行命令
sudo easy_install -U distribute

做了这个伎俩。然后我可以运行sudo pip install --upgrade matplotlib。我会在一分钟内将其添加为答案。

1 个答案:

答案 0 :(得分:5)

删除Canopy后,我运行:

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

我可以通过这种方式升级matplotlib