最新的'pip'失败,"要求setuptools> = 0.8 for dist-info"

oro*_*ome 81 python pip setuptools python-wheel

使用最近的(1.5)版本pip,我在尝试更新多个包时遇到错误.例如,sudo pip install -U pytz导致失败的原因是:

Wheel installs require setuptools >= 0.8 for dist-info support.
pip's wheel support requires setuptools >= 0.8 for dist-info support.
Run Code Online (Sandbox Code Playgroud)

我不明白这个消息(我有setuptools2.1)或者该怎么做.


此错误的日志中的异常信息:

Exception information:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 230, in run
    finder = self._build_package_finder(options, index_urls, session)
  File "/Library/Python/2.7/site-packages/pip/commands/install.py", line 185, in _build_package_finder
    session=session,
  File "/Library/Python/2.7/site-packages/pip/index.py", line 50, in __init__
    self.use_wheel = use_wheel
  File "/Library/Python/2.7/site-packages/pip/index.py", line 89, in use_wheel
    raise InstallationError("pip's wheel support requires setuptools >= 0.8 for dist-info support.")
InstallationError: pip's wheel support requires setuptools >= 0.8 for dist-info support.
Run Code Online (Sandbox Code Playgroud)

小智 148

这对我有用:

sudo pip install setuptools --no-use-wheel --upgrade
Run Code Online (Sandbox Code Playgroud)

注意它是sudo的用法

UPDATE

在窗口中,您只需要以pip install setuptools --no-use-wheel --upgrade管理员身份执行.在unix/linux中,sudo命令用于提升权限.

UPDATE

这似乎已在1.5.1中修复.

  • 请注意,添加的`--no-use-wheel`选项只是跳过['wheel archives'](http://wheel.readthedocs.org/en/latest/#wheel)的使用,但是否则预先形成完全相同的安装作为省略它的命令. (4认同)

use*_*941 11

首先,你永远不应该运行'sudo pip'.

如果可能,您应该使用系统包管理器,因为它使用GPG签名来确保您没有运行恶意代码.

否则,请尝试升级setuptools:

easy_install -U setuptools
Run Code Online (Sandbox Code Playgroud)

或者,尝试:

pip install --user <somepackage>
Run Code Online (Sandbox Code Playgroud)

这当然是"全球"包装.理想情况下,您应该使用virtualenvs.

  • 一般来说,运行pip作为sudo是错误的.但是,有时你*需要在系统python中安装东西(例如virtualenv或pip本身),然后sudo是合适的. (6认同)