Python Can';t在Ubuntu 12.04中升级matplotlib,并安装Corporation

Python Can';t在Ubuntu 12.04中升级matplotlib,并安装Corporation,python,matplotlib,upgrade,enthought,canopy,Python,Matplotlib,Upgrade,Enthought,Canopy,我正试图在ubuntu12.04中升级matplotlib。当我运行命令时: sudo pip install --upgrade matplotlib export PYTHONHOME=/usr/lib/python2.7 我得到这个错误: Downloading/unpacking matplotlib Running setup.py egg_info for package matplotlib The required version of distribute (&

我正试图在
ubuntu12.04
中升级
matplotlib
。当我运行命令时:

sudo pip install --upgrade matplotlib
export PYTHONHOME=/usr/lib/python2.7
我得到这个错误:

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
我认为这与我从
~/.profile
中删除行
source~/enthught/Canopy\u 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

sudo pip install --upgrade matplotlib
export PYTHONHOME=/usr/lib/python2.7
现在
easy\U 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

成功了。然后我可以运行
sudopip安装--升级matplotlib
。我将在一分钟后添加此作为答案。

在移除
天篷后
我运行:

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

这样我就可以升级matplotlib了。

好吧。。您只需重新下载并手动安装即可在
.profile
中删除
源代码..
,注销并再次登录。您需要重新设置您的环境变量。我这样做了,现在每当我尝试从命令行运行
python
时,我都会得到
ImportError:No module name os
。怎么搞的?请提供帮助。@alavin89您遇到了这个错误,因为您的代码中有一行
import os
,并且您的python安装可能已中断。试试这里:谢谢你@Gabriel,我知道了,答案贴在这里: