无法在安装了天篷的Ubuntu12.04中升级matplotlib

2024-09-28 17:17:42 发布

您现在位置:Python中文网/ 问答频道 /正文

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

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

我认为这与我从~/.profile中删除source ~/Enthought/Canopy_64bit/User/bin/activate行有关。我尝试以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。我马上把这个作为回答。


Tags: installpy命令getprefixmatplotliblibeasy