今天我将pip从7.1.0升级到了7.1.2,但现在它无法工作。
$ pip search docker-compose
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip/commands/search.py", line 43, in run
pypi_hits = self.search(query, options)
File "/Library/Python/2.7/site-packages/pip/commands/search.py", line 60, in search
hits = pypi.search({'name': query, 'summary': query}, 'or')
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1240, in __call__
return self.__send(self.__name, args)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1599, in __request
verbose=self.__verbose
File "/Library/Python/2.7/site-packages/pip/download.py", line 788, in request
return self.parse_response(response.raw)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 1490, in parse_response
return u.close()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xmlrpclib.py", line 799, in close
raise Fault(**self._stack[0])
Fault: <Fault 1: "<type 'exceptions.KeyError'>:'hits'">
所以我尝试重新安装:
sudo -H pip install --force-reinstall -U pip
重新安装没有出错,但是当我尝试搜索时,我得到了相同的错误。所以,我尝试重新安装旧版本:
sudo -H pip install --force-reinstall -U pip==7.1.0
重新安装后问题得到解决,但搜索仍然无法正常工作。除了错误提示外,我还收到了版本升级的消息:
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
禁用缓存也会产生相同的错误:
pip search docker-compose --no-cache-dir --disable-pip-version-check
问题似乎只存在于搜索功能中,因为pip仍然能够正常运行以重新安装自身和其他软件包。
我想今天我只安装了一个其他软件包,就是docker-compose。当我搜索除docker-compose之外的软件包时出现了问题,就像我的例子一样。
有任何想法吗?
pip search docker-compose
会在包名称中查找带有docker
或compose
的软件包。(不知道这是否有任何记录?) - denis