本文介绍了无法在安装了Canopy的Ubuntu 12.04中升级Matplotlib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

  sudo pip install --upgrade matplotlib

我收到此错误:

 下载/解压matplotlib为 matplotlib 包运行 setup.py egg_info所需的分发版本 (>=0.6.28) 不可用,并且无法在此脚本运行时安装.请首先安装更新的版本,使用'easy_install -U 分发'.(目前使用分发 0.6.24dev-r0 (/usr/lib/python2.7/dist-packages))来自命令python setup.py egg_info的完整输出:所需的分发版本(> = 0.6.28)不可用,并且在此脚本运行时无法安装.请首先安装更新的版本,使用"easy_install -U分发".(当前使用分发版0.6.24dev-r0(/usr/lib/python2.7/dist-packages))---------------------------命令python setup.py egg_info失败,错误代码为2将完整的日志存储在/home/gabriel/.pip/pip.log

所以我跑:

easy_install -U 分发

我得到:

  Traceback(最近一次通话最近):文件/home/gabriel/Enthought/Canopy_32bit/User/bin/easy_install",第 9 行,在 <module>load_entry_point('distribute','console_scripts','easy_install')()文件/home/gabriel/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/setuptools-0.9.8-py2.7.egg/pkg_resources.py",第378行,在load_entry_point返回 get_distribution(dist).load_entry_point(group, name)在load_entry_point中的第2565行,文件"/home/gabriel/Enthought/Canopy_32bit/User/lib/python2.7/site-packages/setuptools-0.9.8-py2.7.egg/pkg_resources.py"raise ImportError("未找到入口点 %r" % ((group,name),))导入错误:未找到入口点('console_scripts'、'easy_install')

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

如何升级 matplotlib?

添加

我按照说明从此处删除了 Canopy a> 现在当我运行 easy_install -U Distribution 我得到:

 找不到平台独立的库< prefix>找不到平台相关的库< exec_prefix>考虑将 $PYTHONHOME 设置为 <prefix>[:<exec_prefix>]找不到平台无关的库 

找不到平台相关的库< exec_prefix>考虑将 $PYTHONHOME 设置为 <prefix>[:<exec_prefix>]导入错误:没有名为站点的模块

我认为这与我从 ~/.profile 中删除了 source ~/Enthought/Canopy_64bit/User/bin/activate 行有关.我尝试以sudo的身份运行以下命令:

  apt-get自动清理易于清洁apt-get更新apt-get 升级apt-get dist-upgradeapt-get -f 安装dpkg --configure -aapt-get install-重新安装python

但这没有用.有关如何解决此问题的任何想法?

添加2

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

  export PYTHONHOME =/usr/lib/python2.7

,现在 easy_install -U Distribution 返回:

ImportError: No module named site

同样的事情:

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

所以现在就去追赶那个错误.

添加3

设置:

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

然后以 sudo 运行命令:

sudo easy_install -U 分发

成功了.然后我可以运行 sudo pip install --upgrade matplotlib.我会在一分钟内将其添加为答案.

删除 Canopy 后我运行:

export PYTHONHOME=/usr/lib/python2.7/sudo easy_install -U分发须藤 pip install --upgrade matplotlib

我可以这样升级matplotlib.

I'm trying to upgrade matplotlib in Ubuntu 12.04. When I run the command:

sudo pip install --upgrade matplotlib

I get this error:

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

So I run:

easy_install -U distribute

and I get:

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

So there's something not working with my Canopy install. I'm using Spyder right now so I could uninstall Canopy to see if that helps, but the commands sudo apt-get remove enthought* and sudo apt-get remove canopy* find nothing to remove.

What can I do to upgrade matplotlib?


Add

I followed the instructions to remove Canopy from here and now when I run easy_install -U distribute I get:

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

which I believe is related with me deleting the line source ~/Enthought/Canopy_64bit/User/bin/activate from ~/.profile. I tried running the following commands as 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

but that did not work. Any ideas on how to fix this?


Add 2

I tried setting PYTHONHOME with the command:

export PYTHONHOME=/usr/lib/python2.7

and now easy_install -U distribute returns:

ImportError: No module named site

Same thing with:

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

So now off to chase that error.


Add 3

Setting:

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

and then running the command as sudo:

sudo easy_install -U distribute

did the trick. I could then run sudo pip install --upgrade matplotlib. I'll add this as an answer in a minute.

解决方案

After removing Canopy I run:

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

I could upgrade matplotlib that way.

这篇关于无法在安装了Canopy的Ubuntu 12.04中升级Matplotlib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-16 16:11