IndexError:使用pip列出索引超出范围

时间:2017-10-30 09:35:47

标签: python-2.7 pip ubuntu-14.04

我正在使用pip 1.5.4,并尝试使用以下命令为python安装Google Client API:     sudo pip install --upgrade google-api-python-client

但我得到的例外情况是:

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 1260, in 
prepare_files)[0]

IndexError: list index out of range

我尝试使用以下命令升级pip:     sudo pip install -U pip

但它给出了与上述相同的例外。请提出解决方案。

1 个答案:

答案 0 :(得分:2)

它重复我认为: pip install broken (pkg_resources.find_distribution returns empty list in req.py-prepare_files)

所以,解决方案可以是:

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