Python 最新的“pip”失败并显示“需要 setuptools >= 0.8 for dist-info”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20905350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 21:30:12  来源:igfitidea点击:

Latest 'pip' fails with "requires setuptools >= 0.8 for dist-info"

pythonpipsetuptoolspython-wheel

提问by orome

Using the recent (1.5) version of pip, I get an error when attempting to update several packages. For example, sudo pip install -U pytzresults in failure with:

使用最新的 (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.

I don't understand this message (I have setuptools2.1)or what to do about it.

我不明白这条消息(我有setuptools2.1)或如何处理它。



Exception information from the log for this error:

来自此错误日志的异常信息:

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.

采纳答案by Rolandf

This worked for me:

这对我有用:

sudo pip install setuptools --no-use-wheel --upgrade

Note it's usage of sudo

注意它是 sudo 的用法

UPDATE

更新

On window you just need to execute pip install setuptools --no-use-wheel --upgradeas an administrator. In unix/linux, sudocommand is for elevating permissions.

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

UPDATE

更新

This appears to have been fixed in 1.5.1.

这似乎已在 1.5.1 中修复。

回答by user1503941

First, you should never run 'sudo pip'.

首先,你永远不应该运行“sudo pip”。

If possible you should use your system package manager because it uses GPG signatures to ensure you're not running malicious code.

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

Otherwise, try upgrading setuptools:

否则,请尝试升级 setuptools:

easy_install -U setuptools

Alternatively, try:

或者,尝试:

pip install --user <somepackage>

This is of course for "global" packages. You should ideally be using virtualenvs.

这当然适用于“全局”包。理想情况下,您应该使用 virtualenvs。