我决定升级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'
有没有一种简单的方法可以解决这个问题?我是卸载分发还是取消升级(这是如何工作的?)谢谢!
答案 0 :(得分:1)
如果没有更多信息,很难诊断出您的问题,但此解决方案可以安全地尝试,并且很可能会解决您的问题。
首先,确保您只有一个Python 2.7(或者,如果您有多个安装,请确保您使用的所有工具都匹配 - 不要使用/ usr / local / bin / pip尝试安装/ usr / bin / python的包。
接下来,卸载setuptools
,distribute
和pip
。首先尝试使用pip
本身。如果它告诉你还有其他依赖它们的软件包,请在中断之前停止并报告。如果由于权限而失败,请使用chmod
修复权限,然后重试。如果它失败,因为它试图卸载自己感到困惑,这是正常的;只需手动从site-packages
删除软件包。
最后,使用get-pip.py
脚本重新安装pip
。 (与早期版本不同,如果需要,这将自动为您安装setuptools
。)