【发布时间】:2014-09-15 01:11:50
【问题描述】:
我决定升级 pip。 pip --version 为我的 python 2.7 返回 pip 1.2.1
首先,升级steuptools似乎是合理的,因为setuptools.__version__ = '0.6':
pip install -U setuptools
....
Downloading distribute-0.7.3.zip (145kB): 145kB downloaded
Running setup.py egg_info for package distribute
Downloading/unpacking setuptools>=0.7 (from distribute)
Downloading setuptools-5.4.1.tar.gz (782kB): 782kB downloaded
Running setup.py egg_info for package setuptools
Installing collected packages: distribute, setuptools
Found existing installation: distribute 0.6.34
Uninstalling distribute:
Successfully uninstalled distribute
Running setup.py install for distribute
Found existing installation: distribute 0.6.34
Can't uninstall 'distribute'. No files were found to uninstall.
Running setup.py install for setuptools
Installing easy_install script to /usr/local/share/python
Installing easy_install-2.7 script to /usr/local/share/python
Successfully installed distribute setuptools
Cleaning up...
这对于distribute 没有意义。有吗,什么版本的?
但现在,以下内容不起作用(使用 -U 或 --upgrade 选项),因为缺少分发选项:
pip install -U pip
Downloading pip-1.5.6.tar.gz (938kB): 938kB downloaded
Running setup.py egg_info for package pip
path/to/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'entry_points'
warnings.warn(msg)
path/to/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'extras_require'
warnings.warn(msg)
path/to/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'zip_safe'
warnings.warn(msg)
path/to/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'tests_require'
warnings.warn(msg)
usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...] ...
error: invalid command 'egg_info'
有没有简单的方法来解决这个问题?我要卸载分发版还是取消升级(以及它是如何工作的?)谢谢!
【问题讨论】:
-
同时:当
setuptools在 0.6 天内有些停滞时,distribute被创建为一个可以模仿setuptools的分支。从 0.7 开始,这两个项目重新合并为一个。distribute0.7.3 基本上是一个假包,以确保pip install -U distribute将删除任一项目的任何旧版本,并确保您最终只得到setuptools0.7 或更高版本。如果这不起作用,可能值得尝试卸载distribute、setuptools和pip,然后使用get-pip.py脚本安装setuptools和pip。 -
你记得安装过 one 吗?如果是这样,您有两个,因为 Apple 已经为您安装了一个。试试
which -a python;如果你得到的不是/usr/bin/python,你就有两个。 -
好的,这就是你需要先解决的问题。您不能删除 Apple 的,因为操作系统依赖于它(如果没有失败,下一次 OS X 更新无论如何都会重新安装它),但您可以删除另一个。问题是你是否需要它。
-
/usr/local/Cellar表示它绝对是 Homebrew。这完全是另一个问题——从你的路径上的/opt/local/bin,我假设你正在使用 MacPorts,并且在同一台机器上使用 Homebrew 和 MacPorts 是复杂且难以正确处理的。但是,好消息是,Homebrew 为您提供了一种无风险的清理方式:brew unlink python将消除多余的 Python,自动处理所有必要的复杂内容,如果您以后更改你的想法,brew link python将撤消它。 -
(我真的希望这个网站允许没有代表的人聊天;cmets 是一种糟糕的格式,尤其是我们两个都在编辑 cmets 以节省空间,而另一个人正在回复......哦,好吧。)是的,您可能已经为 Homebrew 安装安装了一堆模块,但重新安装它们应该不难。尤其是当你让
pip-1.5工作时,因为如果你使用 Apple 的 Python,几乎所有东西都可能有二进制轮子。
标签: python pip setuptools distribute