5

我正在尝试升级matplotlibUbuntu 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?


添加

我按照说明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。我会在一分钟内将其添加为答案。

4

1 回答 1

5

删除后Canopy我运行:

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

我可以这样升级matplotlib

于 2013-08-05T19:03:39.317 回答