python - pip 安装损坏(pkg_resources.find_distribution 在 req.py-prepare_files 中返回空列表)

标签 python installation pip

在某些时候我的 pip 安装坏了(我怀疑是在升级到 Ubuntu 14.04 时),我无法通过完全删除它并重新安装(通过 synaptic 包管理器)来恢复它。它不会发生在所有包中,但会发生在一些常见的包中,例如 autopep8 甚至 setuptools 本身。

我得到的错误是

Downloading from URL https://pypi.python.org/packages/3.3/p/pep8/pep8-1.5.6-py2.py3-none-any.whl#md5=c7da9fb6a4316b53b6a873de076441e2 (from https://pypi.python.org/simple/pep8/)
Cleaning up...
  Removing temporary dir /tmp/pip_build_tclose...
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1259, in prepare_files
    )[0]
IndexError: list index out of range

发生在 pkg_resources.find_distribution(<what-appears-to-be-a-temp-build-directory-for-package-to-install>) 时返回一个空列表。我有 pip 想法,所以任何指针将不胜感激。

最佳答案

这解决了问题:

pip install --no-use-wheel --upgrade distribute

关于python - pip 安装损坏(pkg_resources.find_distribution 在 req.py-prepare_files 中返回空列表),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23901687/

相关文章:

python - 如何在 X-Y 平面上绘制标签之间的欧氏距离

java - 在 macOS 上安装 Eclipse

python - “Unable to locate finder for ' pip._vendor.diSTLib '” 使用"pip install virtualenv"时出错

python - 多迹线图表上不必要的额外边距

python - 属性错误 : module 'copy' has no attribute 'deepcopy'

python - 使用多行选项和编码选项读取 CSV

ubuntu - 在 ubuntu 14.04 上找不到 libsiftgpu.so

java - 如何在 Linux 中为我的应用程序创建安装程序

python - PyPI 和 pip - 安装的包在读取 README.md 时收到错误

Python 包导入子包 - 好的做法吗?