【问题标题】:Can't upgrade matplotlib in Ubuntu 12.04 with Canopy installed无法在安装了 Canopy 的 Ubuntu 12.04 中升级 matplotlib
【发布时间】:2013-08-06 12:20:19
【问题描述】:

我正在尝试将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

我认为这与我从~/.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。我会在一分钟内将其添加为答案。

【问题讨论】:

  • 好吧..你可以重新下载它matplotlib.org/downloads.html并手动安装它
  • 删除.profile中的source ....,退出并重新登录。您需要重新设置环境变量。

标签: python matplotlib upgrade enthought canopy


【解决方案1】:

删除Canopy后我运行:

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

我可以这样升级matplotlib

【讨论】:

  • 我这样做了,现在每当我尝试从命令行运行python 时,我都会得到ImportError: No module named os。发生了什么?请帮忙。
  • @alavin89 您收到该错误是因为您的代码中某处有import os 行,并且您的python 安装可能已损坏。在这里试试:stackoverflow.com/questions/12320143/…
  • 谢谢@Gabriel,我想通了,答案贴在这里:stackoverflow.com/questions/28534506/…
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-03-01
  • 2012-09-23
  • 2013-10-20
  • 2013-11-22
  • 2012-10-23
相关资源
最近更新 更多