pip install broken(pkg_resources.find_distribution返回req.py-prepare_files中的空列表)

Tom*_*ose 11 python install 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
Run Code Online (Sandbox Code Playgroud)

pkg_resources.find_distribution(<what-appears-to-be-a-temp-build-directory-for-package-to-install>)返回空列表时发生.我有点想法,所以任何指针都会非常感激.

小智 18

这解决了这个问题:

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

  • 有什么解释吗? (2认同)

Tom*_*ose 1

我尝试重新安装 pip,但这不起作用,但最终按照此处的说明重新安装了所有 python-pkg-resources http://ubuntuforums.org/showthread.php?t=2167383

apt-get remove --purge python-pkg-resources

apt-get install ubuntu-desktop
Run Code Online (Sandbox Code Playgroud)

现在它又可以工作了。希望有人觉得这很有用。