使用pip搜索时出错(pip搜索停止工作)

我在学习python时在pip搜索中遇到了这个错误。图片是我pip搜索时的错误。你能告诉我如何解决吗?

$ pip search pdbx
ERROR: Exception:
Traceback (most recent call last):                                                                                                                                                  
  File "*/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 224, in _main                                                
    status = self.run(options, args)                                                                                                                                                
  File "*/lib/python3.7/site-packages/pip/_internal/commands/search.py", line 62, in run                                                    
    pypi_hits = self.search(query, options)                                                                                                                                         
  File "*/lib/python3.7/site-packages/pip/_internal/commands/search.py", line 82, in search                                                 
    hits = pypi.search({'name': query, 'summary': query}, 'or')                                                                                                                     
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1112, in __call__                                                                                                                
    return self.__send(self.__name, args)                                                                                                                                           
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1452, in __request                                                                                                               
    verbose=self.__verbose                                                                                                                                                          
  File "*/lib/python3.7/site-packages/pip/_internal/network/xmlrpc.py", line 46, in request                                                 
    return self.parse_response(response.raw)                                                                                                                                        
  File "/usr/lib/python3.7/xmlrpc/client.py", line 1342, in parse_response                                                                                                          
    return u.close()                                                                                                                                                                
  File "/usr/lib/python3.7/xmlrpc/client.py", line 656, in close                                                                                                                    
    raise Fault(**self._stack[0])                                                                                                                                                   
xmlrpc.client.Fault: <Fault -32500: 'RuntimeError: This API has been temporarily disabled due to unmanageable load and will be deprecated in the near future. Please use the Simple or JSON API instead.'>              

回答

pip search 命令查询 PyPI 的服务器,PyPI 的维护者已经解释说,pip search 命令查询的 API 端点非常耗费资源,而且成本太高,他们无法始终向公众开放。因此,他们有时会限制访问,并且实际上计划很快将其完全删除。

请参阅此GitHub 问题线程...

我现在使用的解决方案是pip install pip-search(由 GitHub 用户 @victorgarric 创建的实用程序)。

因此,我使用 pip_search 而不是“pip search”。绝对胜过通过网络浏览器搜索 PyPI

  • Looks like `pip_search` has been removed - which is a good thing, as it scrapes the website, which just creates another problem for PyPI.
  • Nope, still there ... package name is [pip-search](https://pypi.org/project/pip-search/), but the command it provides is pip_search. Haven't had time to look closely at what it does, but I sure appreciated that when I needed to search through some packages. So I hope they don't remove it.
  • @drkvogel Hmm... people do need to search for packages somehow. Whether they do it from the command line or in a browser, they are still placing load on a server somewhere. I imagine the command line program could be more "polite".

回答

按照 JRK 在 github 讨论中的建议(最后一条评论)搜索命令暂时禁用,同时使用浏览器搜索包:检查github上的线程并给他一个大拇指;)


以上是使用pip搜索时出错(pip搜索停止工作)的全部内容。
THE END
分享
二维码
< <上一篇
下一篇>>