在 Windows 8.1 (python 2.7) 上升级到 pip 7.1.10 时出错

Error while upgrading to pip 7.1.10 on Windows 8.1 (python 2.7)

$ C:\Python27> pip install --upgrade pip

You are using pip version 6.0.8, however version 7.1.0 is available.

You should consider upgrading via the 'pip install --upgrade pip' command.

Collecting pip from https://pypi.python.org/packages/py2.py3/p/pip/pip-7.1.0-py2.py3-none-any.whl#md5=b108384a762825ec20
345bb9b5b7209f

Using cached pip-7.1.0-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 6.0.8
    Uninstalling pip-6.0.8:
      Successfully uninstalled pip-6.0.8

以前版本的 pip 已经消失了,但在那之后我得到了这个异常:

  Rolling back uninstall of pip
  Exception:
  Traceback (most recent call last):


File "c:\python27\lib\site-packages\pip-6.0.8-py2.7.egg\pip\basecommand.py", line 232, in main status = self.run(options, args) 
                               .
                               .
                               .

  AttributeError: 'NoneType' object has no attribute 'bytes'

我升级了 setuptoolsdistribute ,我也尝试手动安装 pip 并得到了这个:

$ C:\Python27> pip install 7.1.10
You are using pip version 6.0.8, however version 7.1.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting 7.1.10
  Could not find any downloads that satisfy the requirement 7.1.10
  No distributions at all found for 7.1.10 

我遇到了同样的问题,然后我查阅了 pip 文档,这就是他们建议升级 pip 的方式:

对于 Windows :

python -m pip install -U pip

对于 Linux :

pip install -U pip

如需进一步参考,请检查此Link

This bugreport 建议做

easy_install -U pip

我走了另一条路。我第一次尝试使用 pip install --upgrade pip 升级在我的 Windows 10 PC 上没有成功。打开命令提示符 (cmd) 后,我首先做了

python -m pip install -U pip

它给了我

Collecting pip
  Using cached pip-8.0.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 1.5.2
    Uninstalling pip-1.5.2:
      Successfully uninstalled pip-1.5.2
Successfully installed pip-7.1.0
You are using pip version 7.1.0, however version 8.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

有趣的是,我试图从 pip 6.1.1 升级到 8.0.2。但是,嘿,我也会进行此升级。他们建议的命令`

python -m pip install --upgrade pip

完成了最后的工作

Collecting pip
  Using cached pip-8.0.2-py2.py3-none-any.whl
Installing collected packages: pip
  Found existing installation: pip 7.1.0
    Uninstalling pip-7.1.0:
      Successfully uninstalled pip-7.1.0
Successfully installed pip-8.0.2

我无法发表评论,所以我将抛出这个问题:在看到您的 post 使用 "easy_install -U pip"

之前,我无法使用任何命令安装 pip

所有其他尝试的结果是

AttributeError: 'NoneType' object has no attribute 'bytes'

我只是先卸载了 pip,然后它起作用了。

python -m pip uninstall pip